Jump to content

issue sleep (S3) command from remote Linux pc [SOLVED]


Recommended Posts

Posted (edited)

Hi. I'm very new to unRaid (~2 weeks setting up) and a novice in Linux. I've got everything mostly how I want it but I cannot figure out how to send a sleep command to unRaid from my Linux HTPC. 

 

I can put it to sleep from a my Windows PC using

 

PLink -pw "<password>"  <user>@<unRaidIP> "echo -n mem>/sys/power/state"

 

(worked that out from reading forum posts here)  but cannot find how to do it from Linux. I've tried

 

ssh <user>@<unRaidIP>  "echo -n mem>/sys/power/state"

 

but that didn't do anything, it also asked for a password.

 

I'm wanting to set up my HTPC to wake the unRaid server when it starts up and put it to sleep when it shuts down so I need a solution that can be run in a script.

 

Can anyone help please?

 

[Solution]

 

Apparently the user has to have sudoers permission to shutdown the server for the above SSH command to work. As for getting around the password prompt you can use SSHPASS  command (sudo apt-get install sshpass) to feed the password as text or from a file.

 

sshpass -p "<Password>" ssh <user>@<unRaidIP> "echo -n mem>/sys/power/state"

or

sshpass -f <path/filename> ssh <user>@<unRaidIP> "echo -n mem>/sys/power/state"

 

I hope this info helps others here.

Edited by Spanners44

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...