The basic idea of this script is for it to read a time stamp out of a text file (and delete it when it's done) and then schedule a task via at.
#!/bin/bash filename=/shares/internal/MYTHTV/waketime.txt if [ -f "$filename" ] then #echo "$filename exists" for JOB in `atq | cut -f 1` ; do atrm $JOB; done at `cat /shares/internal/MYTHTV/waketime.txt | cut --bytes=1-5` << EOF wakelan -m myth_pc_macaddress EOF else echo "$filename does not exist" exit 0 fi sudo rm -f $filename
When I run mythwake.sh (the script below) from ssh bash prompt - as a standard user, (i just type /shares/internal/MYTHTV/mythwake.sh) I get the following output:
[xxxx@wdmbwe /]$ /shares/internal/MYTHTV/mythwake.sh warning: commands will be executed using /bin/sh job 57 at 2009-06-20 08:25 [xxxx@wdmbwe /]$ atq 57 2009-06-20 08:25 a
The job is definitely scheduled and it does run, when I run the script like this. But im not sure why I get the warning…
When I run the script as root (after typing su -), I get the same output as above, except that if I exit and run atq as a user, I don't see anything scheduled, but I do if I log back in as root.. I figure this is a permissions thing.
When I schedule this script to run in a cron job, I cannot see anything listed in the atq list at all… Here is the cron job code if it helps:
#Set MythTV boot 10,25,40,55 * * * * sudo /shares/internal/MYTHTV/mythwake.sh
Can anyone offer any assistance to work through this one? Im so close to getting this to work.. Is it possible that there is some kinda permission error here?? I edited sudoers with visudo and gave my user permission to /bin/*, /opt/bin/* and the script and a bunch of other things…
If anyones got any ideas, please let me know.
Thanks in advance.