I don't like it but one workaround is to immediately modify line 1 of the newly spooled job.
master@chopin~/dev Sat Mar 10,20:52:58$ (4800) atq
616 Tue Mar 13 19:17:00 2012 a master
589 Mon Mar 12 16:16:00 2012 a master
617 Tue Mar 13 19:35:00 2012 a master
591 Mon Mar 12 16:23:00 2012 a master
447 Wed Mar 14 09:25:00 2012 a master
586 Mon Mar 12 15:45:00 2012 a master
master@chopin~/dev Sat Mar 10,20:53:01$ (4800) at -c 447
#!/bin/sh
# atrun uid=1000 gid=1000
# mail master 0
umask 22
...
So that strategy would be to write a wrapper on top of at
that
intercepts its $jobid when at
is run underneath Not needed
- changes the shebang shell line of the newest file in /var/spool/cron/atjobs/ :
sudo <<< 'cd /var/spool/cron/atjobs/ && sed -i -e "1s/\#!\/bin\/sh/\#!\/bin\/bash/" $(ls -1t |head -n1)'
Might be a race condition in case of the at now
by-itself timespec, unless perhaps additional time (like 1 sec) is artificially added. Though in my own use cases, I really need it run now not in 1 sec.
Anyway that's too much of a system hack to comfortably make my scripts use.