Skip to content

Instantly share code, notes, and snippets.

@sh7ning
Created November 3, 2018 03:24
Show Gist options
  • Save sh7ning/73721e17f87b89421e0b2afb38b01499 to your computer and use it in GitHub Desktop.
Save sh7ning/73721e17f87b89421e0b2afb38b01499 to your computer and use it in GitHub Desktop.
crontab docker 相关

crontab 中 没有中断,所以。。

  • docker不能-it
# 更新前
php_exe="docker run --rm -v $sync_tmp_dir:/tmp -v $cur_dir:/tmp/code_base -it $php_img php "

# 更新后
php_exe="docker run --rm -v $sync_tmp_dir:/tmp -v $cur_dir:/tmp/code_base $php_img php "
  • docker-compose exec 要带 -T
docker-compose exec -T php /var/www/ibupro-cloud/file/artisan schedule:run
@sh7ning
Copy link
Author

sh7ning commented Aug 10, 2019

# # Use the hash sign to prefix a comment
# # command 要运行的命令
# # +---------------- 分 (0 - 59) 每分钟用*或者 */1表示 10-12/2
# # |  +------------- 时 (0 - 23)
# # |  |  +---------- 日 of month (1 - 31)
# # |  |  |  +------- 月 (1 - 12)
# # |  |  |  |  +---- 一星期内的天 (0 - 6) (0/7为星期天)
# # |  |  |  |  |
# # *  *  *  *  *  command
#
#crontab file -u nobody 指定文件为某人的定时任务,不带参数 -u 则默认当前用户
#
# * * * * * echo `date` >> /tmp/crontab.log
1 10-20/2 * * * date >> /tmp/dev-mk.schedule.run.log 2>&1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment