I know that I try to work to late in the night and that at this time I'm absolutely unproductive, I work for 5 minutes then switch to a link seen on youtube, then come back to my work, waste some more time on he internet... until 2 in the morning, hour at which I am able to discplinate myself and go to bed.
How could I write a script that automatically shuts down the computer at midnight?
I think I have to use the command crontab
and write the following command in it
shutdown 00:00
I'm asking you if what I do is right, first and optimal or if it exists other ways to do it.
Here is what I made
myComputer:~$ crontab -l
# m h dom mon dow command
55 23 * * * /home/Marine1/soundOfSilence
00 00 * * * shutdown
Here is what is within /home/Marine1/soundOfSilence
#!/bin/bash
mpg123 /path/to/short/sound.mp3
shutdown 5