#!/bin/sh amportal stop shutdown -h now
chmod 744 /usr/sbin/pbx-stop
Un-used Modules > Scheduled Cron Jobs
Create a new scheduled cron job
Times and dates selected below ..
You could better try the existing safe scripts for 'halt' and 'reboot' to be found in /usr/local/sbin/
cat /usr/local/sbin/halt cat /usr/local/sbin/reboot
[macro-shutdown] exten => s,1,Authenticate(1234) exten => s,1,NoOp(Looks like we're going to shutdown!) exten => s,n,System(/usr/bin/sudo /usr/local/sbin/halt ) [macro-reboot] exten => s,1,Authenticate(1234) exten => s,1,NoOp(Looks like we're going to reboot!) exten => s,n,System(/usr/bin/sudo /usr/local/sbin/reboot )
Problem was that in some flavors of Debian/Ubuntu, halt just halted... in a split second. It was fairly obvious that it wasn't shutting anything down gracefully. In the case of MySQL and Asterisk, that was obviously asking for trouble. And that's the reason we implemented the separate halt and reboot scripts in /usr/local/sbin.