OS X: just how to maintain the computer system from resting throughout a ssh session

When I ssh right into a OS X computer system on my network the session lasts till the OS X enters into rest setting.

Exists a means to stop this from taking place throughout my SSH session, in addition to literally bumping the computer mouse or keying keys, or by hand disabling the rest function?

MODIFY: The ssh session would generally be a straightforward sshfs place.

2019-05-07 01:11:18
Source Share
Answers: 2

This is not a out - of - the - box remedy yet it will perhaps function if no person various other thinks of a remedy : -)

You can adjust the power management setups with the command pmset. See the manpage for additional information concerning it.

The intriguing setup we intend to adjust is rest :

rest - system rest timer (value in mins, or 0 to disable)

So we can make use of the adhering to commands :

sudo pmset sleep 25      # go to sleep after 25 minutes
sudo pmset sleep 0       # disable sleep

Now we need to cause these commands after a login and also logut. If I remember this right, Bash is the default covering for Mac OS X which brings us to these 2 documents :

          The personal initialization file, executed for login shells
          The individual login shell cleanup file, executed when a login shell exits

Edit or create them in your house directory site and also add the ideal commands. If you desire, conserve the existing rest value in a short-lived documents and also recover it from it after that.

The last trouble to address is the password prompt of sudo. To offer your customer the approval to invoke pmset with no password, modify your/ etc/sudoers with sudoedit. You require to make use of the NOPASSWD tag. If this is new for you, look at the sudoers manual.

2019-05-08 21:57:53

An internet look for mac protect against rest thinks of a great deal of excellent details on energies and also methods you can make use of.

Nonetheless, in your scenario, I believe that what you actually intend to do is to have a different ssh session that runs a really straightforward command - line program that protects against the Mac from resting. Apple offers the full resource code in Technical Q&A 1160: Preventing sleep. (Unfortunately, this web page is damaged on Apple's website currently, yet you can bring up a duplicate from Google's cache.)

I have not examined to see if this program can be run efficiently from an ssh session, yet it resembles it could.

Keep in mind that sshfs executions commonly do not remain logged right into the remote system regularly, and also simply run a session when they desire a documents or directory site. So you require a different ssh session, running in a decreased terminal window, to run the sleep problems program.

The benefit of this strategy is that you do not require to make use of sudo, or tinker the system power management settings.

2019-05-08 06:20:40