1、定義shell腳本
vi test.sh
錄入要執(zhí)行的命令
source /etc/profile
source ~/.cshrc
date >> /opt/data.txt
?保存退出,并且對(duì)腳本進(jìn)行授權(quán)
?:wq
chmod 777 test.sh
?生產(chǎn)文件data.txt
touch /opt/data.txt
2、配置定時(shí)執(zhí)行
?vi /etc/crontab?
錄入:
一分鐘執(zhí)行一次
*/1 * * * * root /opt/test.sh
?保存退出即可每個(gè)一分鐘執(zhí)行一次文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-580326.html
:wq
配置說(shuō)明:文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-580326.html
*?* * * * command
分時(shí)日月周 ? 命令?
到了這里,關(guān)于Linux下定時(shí)執(zhí)行shell腳本的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!