对于linux 自带crontab而言, xxx.sh的通常编写格式以#!/bin/bash 解释器开头,可在脚本中加入:mysql
date
可是,shell脚本执行 须要 x权限,执行的方式以下:linux
./xxx.sh
sh ./xxx.sh面试
其中,后缀.sh 第一行#!/bin/bash 没有,须要使用sh命令去执行sql
[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 ~]#
其中, shell
* * * * * 分别表明了分、小时、日、月、周、
*/6 */1=*
* 表明 每
面试题: 每隔10s执行一次bash
[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
./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 目标pathspa
CDH升级 原文件不见了 光标跳动:
找原文件文件夹;
删除快捷键文件文件夹--》从新作新的软链接 高版本日志