Once the system is inactive, in 10 minutes it goes in a blank screen (but not in sleep!) and that's precisely the moment I'd like to execute a long-running script in a terminal while I go for a coffee or take a break. When I come back and "wake up" the system (although technically it's not "sleeping"), I can manually stop the running program that has been executed at the screen off.
Example of such a command:
/usr/bin/screen -S screen-off -dm my-command
There is a bunch of similar questions (Execute a script upon logout/reboot/shutdown in Ubuntu) but they address services that are executed upon the sleep and wake up and this does not suit my needs.
while read x
? I imagined a command that is run only once (at the interrupt, speaking of polling and interrupts). – dizcza May 20 '21 at 08:31