gpt4 book ai didi

ubuntu - 在 Ubuntu VPS 上设置 CRON

转载 作者:行者123 更新时间:2023-12-04 18:36:51 25 4
gpt4 key购买 nike

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












我们不允许在 Stack Overflow 上提出有关专业服务器或网络相关基础设施管理的问题。您可以编辑问题,使其成为 on-topic对于堆栈溢出。


7年前关闭。







Improve this question




服务器有Ubuntu 12.10,我尝试安装cron :

sudo apt-get update
sudo apt-get install cron

第二个命令的输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
cron is already the newest version.
The following package was automatically installed and is no longer required:
php5-common
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

然后,当我尝试 sudo /sbin/chkconfig crond on :
sudo: /sbin/chkconfig: command not found
sudo /sbin/service crond start :
sudo: /sbin/service: command not found

crond位于其他地方?或者,我还想念别的东西吗?

谢谢

编辑: ps -ef | grep cron 的输出:
root       716     1  0 May30 ?        00:00:15 cron
deployer 26036 25816 0 10:59 pts/2 00:00:00 grep --color=auto cron

最佳答案

如评论中所示,并按照您提到的教程 How To Use Cron To Automate Tasks On a VPS ,这是你错过的:

  • 检查您的service 在哪里:
    which service
  • 当它返回时,/usr/sbin/service ,那么你必须使用它来启动 cron:
    sudo /usr/sbin/service cron start
  • 这返回了 start: Job is already running: cron给你,所以它已经在运行了。一般来说,要知道它是否正在运行,您可以执行命令
    ps -ef | grep cron
  • 从这一刻起,您拥有cron在您的服务器上运行。您可以使用 crontab -e 对其进行编辑, 查看当前值 crontab -l .你可以用一个假人测试它* * * * * echo "hello" >> /tmp/test123 , 那将写成 hello在/tmp/test123 每分钟。如有需要可在https://stackoverflow.com/tags/crontab/info 中调试.
  • 关于ubuntu - 在 Ubuntu VPS 上设置 CRON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25136679/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com