bash at 命令未执行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10467031/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 02:12:18  来源:igfitidea点击:

at command is not executed

bashunix

提问by hpekristiansen

I am trying to make the atbash command to run, but it is not working for me. I can add a job to the queue, but it is not run when the time is up. What am I doing wrong?

我试图让atbash 命令运行,但它对我不起作用。我可以将作业添加到队列中,但是当时间到时它不会运行。我究竟做错了什么?

hpek@melda:~$ cat /usr/lib/cron/at.deny 
hpek@melda:~$ atq
hpek@melda:~$ at now +2 minutes
echo TTTEEEST
job 12 at Sun May  6 02:09:00 2012
hpek@melda:~$ date
Sun May  6 02:10:24 CEST 2012
hpek@melda:~$ atq
12  Sun May  6 02:09:00 2012
hpek@melda:~$ 

采纳答案by David W.

Take a look at /var/at/jobsand see if your at jobs are listed there. (It may be a different directory based upon OS).

看看/var/at/jobs那里是否列出了您的 at 工作。(它可能是基于操作系统的不同目录)。

By default, atisn't enabled on most systems. In order for atjobs to actually get executed, the atruncommand must execute.

默认情况下,at在大多数系统上未启用。为了at实际执行作业,必须执行atrun命令。

This command is executed either through launchdor through the crondepending upon the system.

此命令是通过launchd或通过cron执行的,具体取决于系统。

The exact mechanisms are different from system to system, so you'll have to read all the various manpages on at, atrun, etc. to verify if atis really enabled on your system, and whether you have permissions to run at jobs. There's normally both an ant allowand an ant denyfile on your system, so you need to check both. You must be both in the allowedfile, and also not in the denyfile.

确切的机制是因系统不同,所以你必须要阅读所有的各种手册页atatrun等核实,如果at您的系统上真的启用,您是否有权在作业运行。您的系统上通常有ant 允许ant 拒绝文件,因此您需要同时检查两者。您必须既在允许文件中,又不在拒绝文件中。

On top of that, you have to make sure that atis even enabled on your system (due to security concerns, it is usually disabled).

最重要的是,您必须确保at在您的系统上甚至启用了它(出于安全考虑,它通常被禁用)。

回答by Paul

It is working fine. It's just that commands running with atdon't write their output to the terminal that you called it from.

它工作正常。只是运行的命令at不会将其输出写入您从中调用它的终端。

Try:

尝试:

at now +2 minutes
echo TTTEEEST > new_file_test

You'll see the file appear in two minutes.

您将在两分钟内看到该文件出现。

回答by sarnold

Check your mail:

请查收你的邮件:

   An at - or batch - command invoked from a su(1) shell will
   retain the current userid.  The user will be mailed standard
   error and standard output from his commands, if any.  Mail
   will be sent using the command /usr/sbin/sendmail.  If at is
   executed from a su(1) shell, the owner of the login shell
   will receive the mail.

回答by Jekis

I've found this here

我在这里找到了这个

First make sure that the at daemon is running using a command like this:

# ps -ef | grep atd
root 8231 1 0 18:10 ? 00:00:00 /usr/sbin/atd

If you don't see atd running start it with this command:

# /etc/init.d/atd start

首先使用如下命令确保 at 守护进程正在运行:

# ps -ef | grep atd
root 8231 1 0 18:10 ? 00:00:00 /usr/sbin/atd

如果您没有看到 atd 正在运行,请使用以下命令启动它:

# /etc/init.d/atd start