一、crontab調度
對於linux 自帶crontab而言, xxx.sh的一般編寫格式以#!/bin/bash 解釋器開頭,可在腳本中加入:
date
但是,shell腳本執行 需要 x權限,執行的方式如下:
./xxx.sh
sh ./xxx.sh
其中,后綴.sh 第一行#!/bin/bash 沒有,需要使用sh命令去執行
1、crontab簡單調度
[root@localhost ~]# crontab -e no crontab for root - using an empty one * * * * * /root/test.sh >> /root/test.log #執行 [root@localhost ~]# crontab -l * * * * * /root/test.sh >> /root/test.log [root@localhost ~]# crontab -l * * * * * /root/test.sh >> /root/test.log [root@localhost ~]#
其中,
* * * * * 分別代表了分、小時、日、月、周、
*/6 */1=*
* 代表 每
面試題: 每隔10s執行一次
[root@localhost ~]# cat test1.sh #!/bin/bash for((i=1;i<=6;i++)); do date sleep 10s done exit [root@localhost ~]# sh test1.sh 2019年 11月 22日 星期五 02:53:18 CST 2019年 11月 22日 星期五 02:53:28 CST 2019年 11月 22日 星期五 02:53:38 CST
2.后台執行
./test.sh &
nohup ./test.sh & 手動啟動腳本 看日志 開發維護 測試
nohup ./test.sh > /root/test.log 2>&1 & 生產上
二、軟連接
[root@localhost ~]# ll total 4 drwxr-xr-x 2 root root 6 Nov 20 21:33 mysql5.6 drwxr-xr-x 2 root root 6 Nov 20 21:33 mysql5.7 drwxr-xr-x 3 root root 44 Nov 17 23:13 ruozedata -rw-r--r-- 1 root root 846 Nov 17 23:12 ruozedata.zip [root@localhost ~]#
ln -s 原path 目標path
CDH升級 原文件不見了 光標跳動:
找原文件文件夾;
刪除快捷鍵文件文件夾--》重新做新的軟連接 高版本