Crontab-简单回显未运行 [英] Crontab - simple echo not running

查看:355
本文介绍了Crontab-简单回显未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到这样的情况:
我想在Linux服务器上使用crontab安排作业。我不是超级用户,因此仅编辑(使用crontab -l,编辑器vim)我的crontab文件。为了进行测试,我把代码放在了这里:

I've got such situation: I want to schedule a job with crontab on a linux server. I'm not super-user, so I'm editing (with crontab -l, editor vim) only my crontab file. For testing, I put there:

* * * * * echo asdf

该作业未运行。是否需要重启服务器?也许是某些管理员的举动?

And the job is not running. Is the restart of the server needed? Or maybe some administrator move?

推荐答案

也许是,cron作业将在自己的shell中运行。因此,您不能指望在控制台上看到 asdf

May be it is, cron jobs will run in their own shell. So you can't expect to see asdf on your console.

您应该尝试的是

* * * * * echo asdf > somefile_in_your_home_directory_with_complete_path.log

接下来通过尾部检查文件:

Next check the file by doing a tail:

tail -f somefile_in_your_home_directory_with_complete_path.log

如果不是,请检查cron守护进程本身是否正在运行或已关闭:

And if it's not, check if the cron daemon itself is running or is down:

# pgrep crond

OR

# service crond status

这篇关于Crontab-简单回显未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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