New answers tagged at
Have the at-script call itself once it's done. # cat t.txt true cat t.txt | at 9am mon # bash t.txt warning: commands will be executed using /bin/sh job 680 at Mon Sep 8 09:00:00 2014 # Just replace true with your actual script.
at can only schedule a command to be run once. You can get around this be making the job schedule itself again, as well as executing your command. Example: ~/myJob.txt: at -f ~/myJob.txt +1 week ; echo "It's 9:00 AM on Monday!" Then you just schedule it once to begin the cycle: at -f ~/myJob.txt 9am monday
My answer is similar to Gnouc’s, but I believe I have a better explanation of the “Why?” When you say at … -f /path/to/my/script.sh, you are telling at to read /path/to/my/script.sh. It copies your script somewhere (probably somewhere under /var/spool/cron) so that atd, the at jobs daemon, can pass the script’s contents to /bin/sh. At this point, the ...
POSIX defined that at can use SHELL environment variable as alternative to /bin/sh, but did not restrict it: SHELL Determine a name of a command interpreter to be used to invoke the at-job. If the variable is unset or null, sh shall be used. If it is set to a value other than a name for sh, the implementation shall do one of the following: use ...
at and batch: read commands from standard input or a specified file which are to be executed at a later time, using /bin/sh. POSIX defines at's input as: a text file consisting of commands acceptable to the shell command language described in Shell Command Language. That is, it's required to be a POSIX sh script. Bash allows Bashisms through ...
Top 50 recent answers are included