home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / init.d / saned < prev    next >
Encoding:
Text File  |  2009-03-27  |  1.7 KB  |  77 lines

  1. #! /bin/sh
  2. #
  3. ### BEGIN INIT INFO
  4. # Provides:          saned
  5. # Required-Start:    $syslog $local_fs
  6. # Required-Stop:     $syslog $local_fs
  7. # Should-Start:      dbus avahi
  8. # Should-Stop:       dbus avahi
  9. # Default-Start:     2 3 4 5
  10. # Default-Stop:      1
  11. # Short-Description: SANE network scanner server
  12. # Description:       saned makes local scanners available over the
  13. #                    network.
  14. ### END INIT INFO
  15.  
  16. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  17. DAEMON=/usr/sbin/saned
  18. NAME=saned
  19. DESC="SANE network scanner server"
  20.  
  21. test -x $DAEMON || exit 0
  22.  
  23. RUN=no
  24. RUN_AS_USER=saned
  25.  
  26. # Include saned defaults if available
  27. if [ -f /etc/default/saned ] ; then
  28.     . /etc/default/saned
  29. fi
  30.  
  31. if [ "x$RUN" != "xyes" ] ; then
  32.     echo "$NAME disabled; edit /etc/default/saned"
  33.     exit 0
  34. fi
  35.  
  36. DAEMON_OPTS="-a $RUN_AS_USER"
  37.  
  38. set -e
  39.  
  40. case "$1" in
  41.   start)
  42.     echo -n "Starting $DESC: "
  43.     start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
  44.         --exec $DAEMON -- $DAEMON_OPTS
  45.     echo "$NAME."
  46.     ;;
  47.   stop)
  48.     echo -n "Stopping $DESC: "
  49.     start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
  50.         --exec $DAEMON
  51.     echo "$NAME."
  52.     ;;
  53.   force-reload)
  54.     # check whether $DAEMON is running. If so, restart
  55.     start-stop-daemon --stop --test --quiet --pidfile \
  56.         /var/run/$NAME.pid --exec $DAEMON \
  57.     && $0 restart \
  58.     || exit 0
  59.     ;;
  60.   restart)
  61.     echo -n "Restarting $DESC: "
  62.     start-stop-daemon --stop --quiet --pidfile \
  63.         /var/run/$NAME.pid --exec $DAEMON
  64.     sleep 1
  65.     start-stop-daemon --start --quiet --pidfile \
  66.         /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
  67.     echo "$NAME."
  68.     ;;
  69.   *)
  70.     N=/etc/init.d/$NAME
  71.     echo "Usage: $N {start|stop|restart|force-reload}" >&2
  72.     exit 1
  73.     ;;
  74. esac
  75.  
  76. exit 0
  77.