「shell」Linuxで日付の処理方法

機能:
20分ごとに3分を増加

1.時間を編集
startnews24.sh
参考コード
echo $(date +"%H:%M" ) > /root/home/timeSyn/startnews24.txt
time1=$(date -d '3 minutes’ +"%H:%M" )
echo $time1 > /root/home/timeSyn/startnews241.txt
date -s “$time1"
exit

2. crontab -eを実行,shellにタスクを加える
*/20 * * * * /root/startnews24/startnews24.sh

3.タイミングタスクが再起動
/sbin/service crond restart

shellscript

Posted by arkgame