Hi
Two points; use ctrl + d to schedule the job, not ctrl + c. This will send the EOT character to at. Be aware it's using sh and not bash to run any scripts.
Code:
matthew-S206:/home/matthew % at now + 1 min
warning: commands will be executed using /bin/sh
at> echo hello > /home/matthew/test1
at> <EOT>
job 14 at Wed Mar 27 20:17:00 2013
matthew-S206:/home/matthew % cat test1
hello
matthew-S206:/home/matthew %
Also the at command is similar to cron in that it does not have the environment your user has.
Let me give you an example.
To play the gangnam style video, i can navigate into my Music directory and type
Code:
matthew-S206:/home/matthew/Music % pwd
/home/matthew/Music
matthew-S206:/home/matthew/Music % mplayer PSY_-_GANGNAM_STYLE_강남스타일_M_V-9bZkp7q19f0.mp4
This will quite happily play the video.
However this, using at, this will not work
Code:
matthew-S206:/home/matthew/Music % at now + 1 min
warning: commands will be executed using /bin/sh
at> mplayer PSY_-_GANGNAM_STYLE_강남스타일_M_V-9bZkp7q19f0.mp4
at> <EOT>
job 15 at Wed Mar 27 20:22:00 2013
matthew-S206:/home/matthew/Music %
That is because it is missing some of my environment.
This, however, will run the video
Code:
matthew-S206:/home/matthew % at now + 1 min
warning: commands will be executed using /bin/sh
at> DISPLAY=:0 /usr/bin/mplayer /home/matthew/Music/PSY_-_GANGNAM_STYLE_강남스타일_M_V-9bZkp7q19f0.mp4
at> <EOT>
job 16 at Wed Mar 27 20:23:00 2013
matthew-S206:/home/matthew %
I have supplied full paths and the DISPLAY environmental variable. Make sure you are supplying everything at needs to run your script
I hope that helps.
Incedently, i have used at and mplayer as an alarm clock in the past.
EDIT:
I think you know this from your first post but i thought i would mention it for any others looking at this thread who do not know.
You can pipe commands into at.
Code:
echo DISPLAY=:0 /usr/bin/mplayer /home/matthew/Music/PSY_-_GANGNAM_STYLE_강남스타일_M_V-9bZkp7q19f0.mp4 | at now + 1 min
Kind regards
Bookmarks