Hello all,
I have the concept of a script that enables a user to schedule when the machine goes to sleep and when it wakes up.
I have written a bash script that writes everything directly to the user crontab file. The minutes (21), hour (20), and seconds to wake (14400) up are written to the crontab file like so:
Code:
21 20 * * * /usr/sbin/rtcwake -m mem -s 14400
I have a crontab scheme that goes like the following:
Code:
* * * * * $HOME/.bin/executable1
* * * * * $HOME/.bin/executable2
So as of current my script violates my crontab scheme. I have tried to write a second script that writes to my crontab file and a file titled: going_to_sleep. The timing seems to be off with my second script and I have no idea what maybe wrong. As you may have guessed this file is located in $HOME/.bin/
Script1.txt is the first script that I describe.
Script2.txt is the second script that I describe.
going_to_sleep.txt is the file that I would like to be edited by the second script.
UPDATE!
I have been playing with this idea some more and I cleaned up my script a little bit. The new file name is script3.txt. I am trying to get the date part to actually say the adjusted time for sleephours and sleepminutes. I can make the date command state the date with an adjusted hour with no issue. It is when I add the sleepminutes variable to it is when I get errors. Anyone know how to adjust the hour and minute of the date command at the same time?