Tag Info

Hot answers tagged

7

From the cron man page: When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists). The children copies of cron running these processes have their name coerced to uppercase, as will be seen in the syslog and ps output. So you should check ...


4

The program that constitutes the at job is a child of the atd (at daemon) process, not of the shell where you run at. So it does not inherit the current shell's environment. The at system arranges to copy the environment (and the working directory and a few more obscure thing), but it omits a few variables. In particular, the DISPLAY variable is not copied ...


3

When does a job become a past job? If you turn on the system at 7:59:50 and the at daemon starts at 8:00:01, should the job be executed? What if the daemon starts at 7:59:59 but takes two seconds to read all of its files? You decide! Start your job with a time check, and abort if the time is past. export execute_by_date=$(date +%s 'tomorrow 8:01') at ...


3

You can pipe the output of atq to sort and use the k switch (sort via key) and M (month-sort) to list your jobs by date. For example, the default output would look like: atq 5 Mon Dec 10 19:00:00 2012 a jason 6 Tue Jan 15 05:00:00 2013 a jason 4 Thu Dec 6 19:00:00 2012 a jason Piping through sort: atq | sort -r -k3M -k4 6 Tue Jan 15 05:00:00 2013 ...


2

From man at: at and batch read commands from standard input or a specified file which are to be executed at a later time, using /bin/sh. So just send the command you would type in interactively to at as input: echo 'rm that.file' | at now+10min


1

With zsh for simple commands: my-batch() {print -r -- ${(qq)@} | batch} my-batch python some_longrunning_computational_script.sh would do it. If you need more complex things like loops or redirections, you could do: my-batch eval 'for i in ...; done' my-batch eval 'echo test > /some/file' But remember to use sh, not zsh syntax. If you want to be ...


1

I would recommend following the advice of @warl0ck in the general case -- create a new script, e.g. /path/to/newscript: #!/bin/bash /path/to/script argument and then run that using at: at -f /path/to/newscript 17:45 This makes it easy to adjust whatever arguments are needed, run multiple commands, etc. Alternatively, for occasional or one-off use, ...


1

My vote is for the cron daemon. If you need to run it at specific times of the day, but not at the same time each day, I'd create a crontab with one entry per day range with an specific execution time: Some examples taken from crontab(5): # run five minutes after midnight, every day 5 0 * * * command # run at 2:15pm on the first of every month 15 14 ...



Only top voted, non community-wiki answers of a minimum length are eligible