如何在docker ubuntu基础上启动cron? [英] How do I start cron on docker ubuntu base?

查看:458
本文介绍了如何在docker ubuntu基础上启动cron?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过 apt-get install cron安装了cron



尝试启动cron失败因为 upstart 未运行。



正确启动cron的命令行是什么(即它将读取用户的crontab,将读取/ etc / crontab / *等)?



请注意,我不想将容器作为完整机器启动,所以我不想运行 / sbin / init upstart 。我通过 supervisord 管理进程,所以我遗漏的是要添加到其配置文件的命令行。

  root @ xxxxxx:〜# cron -f 









  • 我在新容器中启动了/ bin / bash

  • apt-get install cron nano screen

  • getty tty -a root

  • 屏幕,在屏幕中我创建了2个终端:

  • 第一个: cron -f

  • 第二: crontab -e - 编辑您的crontab,保存,你可以看到cron是工作。 ..


I have installed cron via apt-get install cron

Trying to start cron fails (as expected) because of upstart not running.

What is the command line for starting cron properly (i.e. it will read users' crontabs, will read /etc/crontab/* etc)?

Please note that I do not want to start the container as a "full" machine, so I don't want to run /sbin/init or upstart. I manage the processes via supervisord, so what I 'm missing is the command line to add to its configuration file.

解决方案

You can run cron without daemon mode.

root@xxxxxx:~# cron -f


I was just trying to test it:

  • I started /bin/bash in a new container
  • apt-get install cron nano screen
  • getty tty -a root
  • screen, in screen I created 2 terminals:
  • first: cron -f
  • second: crontab -e - edit your crontab, save and you can watch that the cron is working ...

这篇关于如何在docker ubuntu基础上启动cron?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆