0

Is it possible to request for a job to be run at a later specifed time in the background?

This is what I have so far,

 nohup nice MY_PROGRAM > foo.out 2> foo.err < /dev/null | at 05:23 PM Mon & echo $!

However, It echos back a process Id e.g. (18454) This process ID doesnt actually exist, that is, if run

ps 

This is the process ID that is assigened to that job

 18453 pts/2    00:00:00 MY_PROGRAM

thats is PID-1 = PID somehow? Any idea why that happens? or in theres any error in my command?

1

at reads the command to execute from the standard input.

You are not sending the command to execute to at. You are executing your command and sending the output of your command to at.

Try something like:

echo 'nohup nice MY_PROGRAM > foo.out 2> foo.err < /dev/null' | at 05:23

The echo command will print the string 'nohup nice MY_PROGRAM' and the | will pass it to at.

I do not know why do you use nohup but probably you do need it as at jobs are not interactive.

P.S. Note the use of single quotes (') to pass the command to echo as a string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.