0 6 * * 0 /root/SST/myscript.sh
行全体を更新された文字列に置き換えるにはどうすればよいですか?
スクリプトは次を使用して実行され、update.sh 7
それによって0 6 * * 0 /root/SST/myscript.sh
置き換えられます0 7 * * 0 /root/SST/myscript.sh
hour
cron エントリは動的になります (変更される可能性があります) 0 * * * 0 /root/SST/myscript.sh
。
[root@local ~]# crontab -l
0 1 * * 0 /root/SST/test.sh
0 6 * * 0 /root/SST/myscript.sh
0 10 * * 0 /root/SST/test.sh
シェルスクリプトの内容update.sh
:
#!/bin/bash
tmpfile=$(crontab -l)
if [[ "$tmpfile" == *myscript.sh* ]]
then
#update myscript.sh within crontab contents
echo "$updatedfileContents";
fi