By execution of a bash script which takes a long time to run I will prevent a manual executed system sleep/shutdown/reboot. It would be nice if the logged on user will get a message but it´s not necessary. Normally I´m looking for a working solution for OS X but for Linux would also be nice.
Asked
Active
Viewed 1,528 times
0
-
1possible duplicate of [Temporarily prevent linux from shutting down](http://stackoverflow.com/questions/322254/temporarily-prevent-linux-from-shutting-down) – rpax May 26 '14 at 09:43
-
3On OS X, you can use the [`caffeinate` command](https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man8/caffeinate.8.html) to prevent sleep. – Ken Thomases May 26 '14 at 09:51
-
@rpax Well it sounds like my question but there are no accepted answer :(. – UsersUser May 26 '14 at 10:40
-
@KenThomases I know caffeinate but I don´t know if it works with an manual initiated sleep/reboot/shutdown – UsersUser May 26 '14 at 10:42
-
1From the man page, it looks like the `-s` option can prevent a manual initiated sleep. Don't know about reboot or shutdown. – Ken Thomases May 26 '14 at 11:29
-
@KenThomases: If your write your solutions as an answer I could accept it :) – UsersUser Nov 13 '14 at 09:10
1 Answers
2
On OS X, you can use the caffeinate -s /path/to/your/script
command to prevent sleep while your script runs.

Ken Thomases
- 88,520
- 7
- 116
- 154