LJ Archive

Listing 3. Script for diald Management

#!/bin/sh
# description: Starts and stops the diald
# diald-on-demand process
# Marcel Gagné - Salmar Consulting Inc.
# See how we were called.
case "$1" in
  start)
     echo -n "Starting diald process: "
     /usr/sbin/diald
     echo "Done!"
     ;;
  stop)
     echo -n "Shutting down diald : "
     kill 'pidof -s diald'
     echo "Waiting 2 seconds for process to \
shut down ..."
     sleep 2
     kill 'pidof -s diald'
     ps ax | grep diald | grep -v grep |
       grep -v control
     echo "Done!"
     ;;
  restart)
     echo "Restarting /usr/sbin/diald process: "
     kill 'pidof -s diald'
     echo "Waiting 2 seconds for process to \
shut down ..."
     sleep 2
     /usr/sbin/diald
     echo "Done!"
     ;;
  getfax)
     echo -n "Preparing to receive a single fax:"
     kill 'pidof -s diald'
     echo "Waiting 2 seconds for process to \
shut down ..."
     sleep 2
        /sbin/mgetty /dev/ttyS0 < /dev/null &
        echo "starting mgetty on port ttyS0..."
     echo "Done!"
     ;;
  *)
     echo "Usage: diald.control \
{start|stop|restart|getfax}"
     exit 1
esac
LJ Archive