泊坞窗:的cronjob不工作 [英] Docker: Cronjob is not working

查看:274
本文介绍了泊坞窗:的cronjob不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行多克尔容器cron作业。我有一个正在运行的容器(Fedora的20)。
我也装在容器中的cron包和明确运行cron守护程序。
我还检查cron.deny文件是空的,也没有所谓的cron.allow和/ etc /目录下。文件

I am trying to run cron job on Docker container. I have a running container (Fedora 20). I have also installed cron packages in container and explicitly run the cron daemon. I have also checked cron.deny file it is empty and there is no file called cron.allow under /etc/ directory.

Whenever I tried to set the cronjob by using crontab -e or trying to list the cron job using 

    crontab -l I am getting following error.

bash-4.2# crontab -l
You (root) are not allowed to access to (crontab) because of pam configuration.


bash-4.2# crontab -e
You (root) are not allowed to access to (crontab) because of pam configuration.

我也查了/etc/pam.d/crond文件,它具有以下条目

I also checked the /etc/pam.d/crond file it has following entry

的bash-4.2#VI /etc/pam.d/crond

bash-4.2# vi /etc/pam.d/crond

#
# The PAM configuration file for the cron daemon
#
#
# No PAM authentication called, auth modules not needed

account    required   pam_access.so
account    include    password-auth
session    required   pam_loginuid.so
session    include    password-auth
auth       include    password-auth

一直面临着这个问题的呢?如果是的话请您建议我一些这方面的指针?

Has any one faced this issue? If yes could you please suggest me some pointer on this?

先谢谢了。

推荐答案

这是LXC容器是不是虚拟机。你需要显式地在前台运行cron守护程序。更妙的是,从程序如监事运行cron 或<一个href=\"http://tech.paulcz.net/2013/10/managing-docker-services-with-this-one-easy-trick.html\">runit.

An LXC container is not a virtual machine. You'll need to explictly run the cron daemon in the foreground. Better still run cron from program like Supervisor or runit.

参考:泊坞文档

传统泊坞窗容器中运行一个进程时,它是
  推出,例如一个Apache后台程序或SSH服务器守护程序。经常
  虽然要在容器中运行多个进程。有
  许多方法可以使用​​一个简单的击实现此测距
  脚本作为容器的CMD指令来安装值
  一个进程管理工具。

Traditionally a Docker container runs a single process when it is launched, for example an Apache daemon or a SSH server daemon. Often though you want to run more than one process in a container. There are a number of ways you can achieve this ranging from using a simple Bash script as the value of your container's CMD instruction to installing a process management tool.

在这个例子中,我们要利用流程管理
  工具,监事,在我们的容器来管理多个进程。运用
  监事可以让我们更好地控制,管理,并重新启动
  流程我们要运行。为了证明这一点,我们要安装
  并管理一个SSH守护和Apache的守护进程。

In this example we're going to make use of the process management tool, Supervisor, to manage multiple processes in our container. Using Supervisor allows us to better control, manage, and restart the processes we want to run. To demonstrate this we're going to install and manage both an SSH daemon and an Apache daemon.

这篇关于泊坞窗:的cronjob不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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