action to reboot / shutdown server

Posted on
Sun Nov 25, 2018 7:15 pm
kw123 offline
User avatar
Posts: 6478
Joined: May 12, 2013
Location: Dallas, TX

action to reboot / shutdown server

put this into an action / server / execute script :
Code: Select all
import os
myPassword = "put my password here"

# for reboot:
cmd = "/sbin/reboot"

# for shutdown
#cmd = "/sbin/shutdown now"

os.system("echo '"+ myPassword + "' | sudo -S "+cmd+" &")

when executed the mac indigo server will reboot or will shut down depending on the option chosen.

Karl
Attachments
Screen Shot 2018-11-25 at 19.14.02.png
Screen Shot 2018-11-25 at 19.14.02.png (45.37 KiB) Viewed 1281 times

Posted on
Mon Nov 26, 2018 1:06 am
howartp offline
Posts: 3628
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: action to reboot / shutdown server

Awesome!


Sent from my iPhone using Tapatalk Pro

Posted on
Mon Nov 26, 2018 11:56 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: action to reboot / shutdown server

Mac Commander also does this as well as lets you run anything on a remote Mac.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue Nov 27, 2018 10:53 am
kw123 offline
User avatar
Posts: 6478
Joined: May 12, 2013
Location: Dallas, TX

Re: action to reboot / shutdown server

@Colorado4Wheeler.. downloaded your plugin.. how would you use it to reboot / shutdown the server. I do see sleep, stop/start apps.
one thing I really would like to to do is to stop a plugin wait and then restart it, not the reload action of indigo.
I did a "tell system ... move , pick .." but that depends on plugin position in the menu ..
Indigo does not expose a lot of properties to apple script (and will likely not add any) so that a direct command is not available.

thanks

Karl
ps looking at your plugin code inspires me to try a lot of new things.
Attachments
Screen Shot 2018-11-27 at 10.49.22.png
Screen Shot 2018-11-27 at 10.49.22.png (21.03 KiB) Viewed 1159 times

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests