You may know about the at utility, which lets you run commands at some time in the future. For example, at -f ./script.sh now + 1 minute will execute the script in one minute - if the stars align.

at has two limitations which keep bugging me: - at rounds the time up to the beginning of a minute, i.e. your command or script will always execute at the zero-th second of the minute which follows your intended time of execution. If you need temporal precision you're screwed. - at doesn't preserve the environment of the calling shell. atd, the at daemon will execute the file or the command in its own, minimal environent, which is a nuisance if you're running commands which depend on environment variables. Wanna remind yourself that your tea is ready via a notify-send "Bro, tea is ready"? Forget it, $DISPLAY is undefined.

So my question is: Does an alternative to at exist which has second precision and which preserves the environment?

Thank you!

submitted by /u/agentsmurf6
[link] [comments]