AppleScript C Perl Shell Xcode Other

How to shutdown FreePBX remotely in case of power outage

Post Reply
coding / shell     Views: 2927Prev .. Next
How to shutdown FreePBX remotely in case of power outagePosted: Monday, October 16, 2017 [15:13:20] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 356
If your FreePBX sits on the same power back-up UPS with your Mac, while Mac shutting down other "UPS unaware" computers this code can be added to shutdown script to turn-off your FreePBX as well.
Shut-down script described here:
https://www.codemacs.com/coding/shell/shutting-down-all-your-macs-on-power-outage.6740181.htm

View Code`ssh root@FREEPBX_IP 'fwconsole stop'`;
sleep(45); ## Wait for Asterisk to shutdown
`ssh root@FREEPBX_IP 'shutdown -h now'`;

as usual, you may want to include a full path to the appropriate commands as:
View Code/usr/bin/ssh
/usr/sbin/asterisk
/usr/sbin/shutdown

The code above will gracefully stop asterisk and then shutdown a FreePBX box.

Also, make sure your remote machine is set to auto-login to FreePBX, otherwise instead of processing command your script will get a password prompt and no command will be processed.There's no place like ~
coding / shellPrev .. Next
 
Post Reply
Home - Coding: AppleScript C Perl Shell Xcode Other
Our Telegram Group