1.5 Administrator's Guide

  1. Home
  2. Docs
  3. 1.5 Administrator’s Guide
  4. Advanced Administration
  5. Asterisk PBX software management
  6. Stopping and restarting the Asterisk PBX software

Stopping and restarting the Asterisk PBX software

For certain maintenance tasks it may be necessary to temporarily stop or restart the
AsterisPBX software.

Restarting Asterisk

To restart the Asterisk PBX software:
sudo /etc/init.d/asterisk restart

Stopping Asterisk

To stop the Asterisk PBX software, waiting until there are no longer any active calls,
but allowing new calls in the interim:
sudo asterisk ­rx “stop when convenient”
To stop the Asterisk PBX software, waiting until there are no longer any active calls,
without allowing new calls in the interim:
sudo asterisk ­rx “stop gracefully”
To stop the Asterisk PBX software immediately:
sudo /etc/init.d/asterisk stop

Starting Asterisk

To start the Asterisk PBX software:
sudo /etc/init.d/asterisk start

Notify when no calls

In some situations you may want to wait until there are no calls on the sytem before
performing some action. The script below will print the message “0 active channels”
when no calls are active:
#!/bin/bash 
while [ 1 ­lt 2 ]; do 
  printf “.” 
  sudo asterisk ­rx “core show channels” | grep ­x “0 active calls” 
  sleep 1 
done