I'm trying to set up a script for my school's computer that switches them off automatically at the end of the day (since most teachers forgot them on).
I thought to send a zenify warning box to inform the user that the PC is going to switch off and, if the user do not confirm in 1 minute, the PC shuts down.
I know the existence of the timeout command, but in this case I want to call sudo shutdown -h now if the zenity command do not return in 60 seconds.
I was trying to do something like
timeout 60 --onTimeout="sudo shutdown -h now" zenity --warning --text="This PC is going to shut down in a minute if you DO NOT press the OK button."
The command would be executed in a cron script.
So, the question is: How can I execute a command when the zenity program timeout?