I'd like to force my account to log out at a specific time as a self-restraint measure (e.g., to ensure I go to bed on time). And for the script to run whenever I try logging in after that time between two specified times (e.g., 11pm-5am). Potentially tied to internet time so it cannot be avoided through simply changing the time. Perhaps making use of:
sudo pkill -KILL -u <username>
shutdown
the computer (gracefully) at a specified time. You can also consider a warning five minutes before logout/shutdown. – sudodus Jul 12 '18 at 08:51pkill -KILL -u <username>
2) configuresudo
so that thesudo
command is not allowed between 11pm and 5am (see NOTBEFORE, NOTAFTER tags in the man page), so you cannot undo the cronjob in these hours. – PerlDuck Jul 12 '18 at 09:22*/2 0,1,2,3,4,23 * * * <username> pkill -KILL -u <username>
– Jul 12 '18 at 10:50