I have a script that sends the PC to sleep and wakes on the 1st of the month:
This is saved as /home/steve/SuspendWake.sh
#current system time and waketime
THISYEAR=`date +'%Y' -d 'now'`
NEXTMONTH=`date +'%m' -d 'next month'`
#if next month is January, increment the year by 1
if [ $NEXTMONTH == 01 ]
THISYEAR=`date +'%Y' -d '1 year'`
#current system date and wake date(1st of next month)
IFS=: read old_hour old_min <<< "$old"
IFS=: read hour min <<< "$new"
# convert the date in seconds from Unix EPOCH time
sec_old=$(date -d "$olddate $old_hour:$old_min:00" +%s)
sec_new=$(date -d "$newdate $hour:$min:00" +%s)
DIFFERENCE=$(( (sec_new - sec_old) ))
#lock the screen
#suspend the system and wake in this many seconds
sudo rtcwake -m mem -s $DIFFERENCE
From the terminal, if I type
the script runs as expected.
I have created a desktop launcher to run the script above but it asks me for a password. If I change the desktop launcher command to
it still asks for a password, as does:
I have tried adding to visudo as follows:
but still no luck!
Steve ALL= NOPASSWD: /home/Steve/SuspendWake.sh
Can anyone help getting the launcher to run without asking for a password?