[asterisk-users] restart system from extension

J Montoya or A J Stiles asterisk_list at earthshod.co.uk
Fri Apr 7 03:24:34 CDT 2017


On Thursday 06 Apr 2017, Atux Atux wrote:
> hi. i would like to be able to reboot the system from my extension. is that
> possible? if yes, how?

It's possible, with something this in extensions.conf;

exten => 999999,1,NoOp(Restarting server now)
exten => 999999,n,System(shutdown -r now)

Then dial 999999.

NB this is UNTESTED, for obvious reasons!  You probably do not want this 
extension to be in a context that anyone besides you can access.  And if you 
are not running Asterisk as root, then you will need to write a C wrapper 
around the shutdown binary and make it setuid root.


But just because it is possible, does not mean it is not a really, really 
terrible idea.  The real question is, WHY are you wanting to be able to reboot 
your server from your extension?  Because there is almost certainly a better 
way of achieving whatever it is that you are hoping to achieve.

-- 
JM or AJS

Note:  Originating address only accepts e-mail from list!  If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .



More information about the asterisk-users mailing list