I'm using Linux Mint and have trouble stopping computer use at a reasonable hour. Reminders and alarms are too easy for me to ignore, so I'm looking for a more enforceable solution—ideally something that shuts the computer down at a chosen time, such as 11 PM, and possibly prevents it from staying on during overnight hours. What software, scripts, cron jobs, or other methods would work?
5 Answers
You can make the shutdown conditional so the computer is turned off throughout a blocked period. For example, a script can check whether the current hour is between 11 PM and 6 AM and run `/sbin/poweroff` during that window. A root cron job running every couple of minutes could enforce it even if the computer is restarted during the restricted hours. Be careful with permissions and test the script before relying on it.
For a simple one-time limit, a small Bash script is enough: `sleep 3600` followed by `poweroff` will shut the computer down after an hour. You could add a warning beforehand, such as a desktop notification five minutes before shutdown, and then give yourself time to save anything important.
The technical solution can help, but it’s also useful to add a physical barrier. Put a separate alarm or timer somewhere that requires you to get up and leave the computer to turn it off. Combining that with an automatic shutdown gives you both an external reminder and a consequence that’s harder to ignore.
Workrave may be worth trying if you want something less drastic. It can remind you to take breaks and enforce a daily usage limit. Unlike a normal alarm, it can make the limit harder to casually dismiss, though a determined user can still disable almost any software restriction.
A cron job can shut the machine down at the same time every night. Run `crontab -e` and add a line such as `45 22 * * * /sbin/shutdown -h now` to shut down daily at 10:45 PM. Make sure you save your work first, since this won’t give applications much opportunity to recover unsaved data.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures