尊敬的读者您好:笔者很高兴自己的文章能被阅读,但原创与编辑均不易,所以转载请必须注明本文出处并附上本文地址超链接以及博主博客地址:https://blog.youkuaiyun.com/vensmallzeng。若觉得本文对您有益处还请帮忙点个赞鼓励一下,笔者在此感谢每一位读者,如需联系笔者,请记下邮箱:zengzenghe@gmail.com,谢谢合作!
1、系统定时命令: crontab -e
在linux系统中,输入crontab -e即可进入新增定时任务的界面,在这里按照指定格式编写定时任务即可。
编写格式:
* * * * * command
分 时 日 月 周 命令
① 第1列表示分钟:1~59 每分钟用*或者 */1表示
② 第2列表示小时:0~23(0表示0点)
③ 第3列表示日期:1~31
④ 第4列表示月份:1~12
⑤ 第5列表示星期:0~6(0表示星期天)
⑥ 第6列表示:将要运行的命令
crontab文件的一些例子:
每天10:00进行亲子用户预测。
00 10 * * * sh /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
每月1、10、22日的4:45进行亲子用户预测。
45 4 1,10,22 * * /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
每周六、周日的1:10进行亲子用户预测。
10 1 * * 6,0 /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
每天5:00至23:00之间每隔65分钟进行亲子用户预测。
1,5 5-23 * * * /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
每一小时进行亲子用户预测
* */1 * * * /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
晚上11点到早上7点之间,每隔一小时进行亲子用户预测
* 23-7/1 * * * /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
每月的4号与每周一到周三的11点进行亲子用户预测
0 11 4 * mon-wed /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
1月1号的4点进行亲子用户预测
0 4 1 jan * /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
1月1号的4点进行亲子用户预测
0 4 1 jan * /home/hotel-revenue-online/zengzeng.he/common_project/consume_level/auto_do_sample.sh
2、对某篇文档的指定字符进行替换命令:sed
将文档”20191101_20200501.txt“中全部,号替换成\001
sed -i "s/,/\\001/g" 20191101_20200501.txt
3、当使用ssh登录服务器出现如下问题时:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:GYNcxlClLO2kF0xy5/oE9EowizK0JVjz9tyojDap2YU.
Please contact your system administrator.
Add correct host key in /Users/hezz/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/hezz/.ssh/known_hosts:1
RSA host key for ssh2.17usoft.com has changed and you have requested strict checking.
Host key verification failed.
解决方法:
① 手动删除修改known_hsots里面的内容;rm -rf ~/.ssh/known_hosts【建议这个】
② 修改配置文件“~/.ssh/config”,加上这两行,重启服务器。
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
③ 当使用scp命令出现这种情况时,请使用命令清除所连接的IP:ssh-keygen -R 10.161.118.4[本地ip],然后再使用scp命令
日积月累,与君共进,增增小结,未完待续。