在 crontab 中的时间或日期格式的写法需要转义
* * * * * echo $(date +"\%Y-\%m-\%d \%H:\%M:\%S" -d "-1day") >> ~/test.log
可根据自己需要灵活修改格式
记录下省的到处搜索
定时任务中日期格式不生效?date function not work with crontab ?
积跬步,至千里
在 crontab 中的时间或日期格式的写法需要转义
* * * * * echo $(date +"\%Y-\%m-\%d \%H:\%M:\%S" -d "-1day") >> ~/test.log
可根据自己需要灵活修改格式
记录下省的到处搜索
定时任务中日期格式不生效?date function not work with crontab ?
Copyright © 2024 JeeInn的技术分享 | 冀ICP备2023009855号-2