当前位置:网站首页>Regular execution of shell scripts in crontab

Regular execution of shell scripts in crontab

2022-06-11 22:03:00 Write more articles to make your hair grow

First step : To write shell Script

 Insert picture description here
shell The command in the second line of the script does one thing : Write the time when the script is executed /mysqlback/test.log file

#!/bin/bash
echo $(date "+%Y-%m-%d %H:%M:%S")>>/mysqlback/test.log

The second step : add to crontab Timing task

Execute the following command to open the scheduled task editor

crontab -e

Add timing task
 Insert picture description here

*/1 * * * * /bin/sh /mysqlback/test.sh

*/1 * * * * This is the execution frequency of the scheduled task , Means to execute... Every minute
/bin/sh /mysqlback/test.sh This is what you created in step 1 shell Script

原网站

版权声明
本文为[Write more articles to make your hair grow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206112142215683.html

随机推荐