✸ ✸ ✸
crontab采坑date格式化
crontab计划任务
0 11 * * * bash /data/git/git_clone.sh > /data/git/`date +%Y%m%d`.log 2>&1 &
/var/log/cron输出被截断
Aug 20 11:00:01 VM_17_2_centos CROND[23849]: (root) CMD (bash /data/git/git_clone.sh > /data/git/`date +)
修改crontab转义百分号%
3 11 * * * bash /data/git/git_clone.sh > /data/git/`date +\%Y\%m\%d`.log 2>&1 &
/var/log/cron输出正常
Aug 20 11:03:01 VM_17_2_centos CROND[24238]: (root) CMD (bash /data/git/git_clone.sh > /data/git/`date +%Y%m%d`.log 2>&1 &)
✸ ✸ ✸
📜 版权声明
本文作者:王梓 | 原文链接:https://www.bthlt.com/note/11892093-Linuxcrontab采坑date格式化
出处:葫芦的运维日志 | 转载请注明出处并保留原文链接


📜 留言板
留言提交后需管理员审核通过才会显示