标签:
参考:
http://blog.csdn.net/xrt95050/article/details/3980567
http://www.cnblogs.com/zhenmingliu/archive/2012/04/27/2472958.html
服务名称:crond
查看服务状态示例:
service crond status systemctl status crond #CentOS 7
设置方法:
1.命令行运行:crontab -e
2.命令行运行:vim /etc/crontab 添加内容
示例:
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 45 */1 * * * root /usr/local/bin/sshpass -p "abcdefg" ssh -p2222 ghost@123.123.123.123 #每小时的第45分钟以root用户ssh登录主机123.123.123.123
若要关闭邮件通知:
45 */1 * * * root /usr/local/bin/sshpass -p "abcdefg" ssh -p2222 ghost@123.123.123.123 >/dev/null 2>&1
PS
手动删除/var/log/secure的内容后,需要重启日志服务:service rsyslog restart #CentOS下
标签:
原文地址:http://www.cnblogs.com/flowjacky/p/4310804.html