I have a long running script at the remote computer.
I don't want terminate my ssh session, and need enter it into a shell script.
How is it possible to prevent my Mac from falling into sleep from the command line?
In Mountain Lion you can use the
will prevent idle sleep for 1000 seconds.
The solution to this problem is not keeping the client (your Mac) awake. Using approaches like this are undependable. What happens if the network connection is lost? Even if your Mac is awake, the script will halt.
If your long-running script is called
Now you can even close the connection and your script will keep running. The
The paths in the examples are optional if the script is on your path and you want script output to be written to
I manage scripts that run for days at a time. Scripts like these should be detached from the terminal. Thankfully,
|show 1 more comment|
Results: Your system will not sleep as long as the
Another option is pmset. Use the command
Edit: According to binarybob's comment, you can actually run it in the background like this: