Linux Command configuration scp + crontab + mail, scpcrontab
Remote replication:
Example: log on to server A and copy all the files under/sh of server A to the/sh folder of server 172.18.100.200.
Scp/sh/* root@172.18.100.200:/sh # Need to know the password of 172.18.100.200
Batch kill Processes:
Example: many processes need to be killed in ps-ef | grep Download/popUnlink.
Root 28300 28297 16 00:14:22 pts/1 php admin. php Download/popUnlink
Root 28301 28297 16 00:14:22 pts/1 php admin. php Download/popUnlink
Root 28302 28297 16 00:14:22 pts/1 php admin. php Download/popUnlink
Root 28303 28297 16 00:14:22 pts/1 php admin. php Download/popUnlink
Root 28304 28297 16 00:14:22 pts/1 php admin. php Download/popUnlink
ps -ef|grep Download/popUnlink|grep -v grep|awk '{print $2}'|xargs kill
Set a shortcut command (alias):
For example, if git is installed in the/usr/local/git directory and you do not want to pull code every time, you need such a long command as/usr/local/git/bin/git pull origin master, you can directly use git pull origin master to pull
Vim ~ /. Bashrc # Open the bash configuration file alias git = '/usr/local/git/bin/git' in the home directory # Set the alias source ~ /. Bashrc # Set the configuration file
Configure email sending:
Example: Configure 126 mailbox as the sender of the linux Mail Service and send the test email
Vim/etc/mail. rc set from = openweixin666@126.com # Your mailbox set smtp = smtp.126.com # mailbox corresponding smtp server address set smtp-auth-user = openweixin666@126.com set smtp-auth-password = ***** * # set smtp-auth = login
Test sent Email: echo 'your content! '| Mail-S' your title' 269754243@qq.com
Scheduled task crontab:
Example: execute a task at every day to access a website
Crontab-e. If no installation is prompted, yum-y install crontab
There are five stars in the crontab period *** command
Represented from left to right"Command to be executed in minutes, hours, days, months, and Weeks"
Run the command */1 *** cd/var/www/www.duoduofenqi.com & php index every minute. php Home/Phone/handle_exception10 *****/sh/chech_hard_dish.sh # execute the command 10 minutes each hour # execute the task at AM/access the register Method of the index controller of the home Module 20 0 * **/cd/var/www/www.duoduofenqi.com & php index. php Home/index/register # xxx task 30 10x3/sh/check_nginx_log.sh every Wednesday