/rc3.d/S20atop

http://github.com/brinkman83/bashrc · Shell · 64 lines · 32 code · 6 blank · 26 comment · 1 complexity · 22f7757353763d4884985edd2fd6867f MD5 · raw file

  1. #! /bin/sh
  2. #
  3. # atop init script
  4. #
  5. ### BEGIN INIT INFO
  6. # Provides: atop
  7. # Required-Start: $syslog
  8. # Required-Stop: $syslog
  9. # Should-Start: $local_fs
  10. # Should-Stop: $local_fs
  11. # Default-Start: 2 3 4 5
  12. # Default-Stop: 0 1 6
  13. # Short-Description: Monitor for system resources and process activity
  14. # Description: Atop is an ASCII full-screen performance monitor,
  15. # similar to the top command, but atop only shows
  16. # the active system-resources and processes, and
  17. # only shows the deviations since the previous
  18. # interval.
  19. ### END INIT INFO
  20. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  21. DAEMON=/usr/bin/atop
  22. DARGS="-a -w /var/log/atop.log 600"
  23. NAME=atop
  24. DESC="atop system monitor"
  25. test -x $DAEMON || exit 0
  26. set -e
  27. case "$1" in
  28. start)
  29. echo -n "Starting $DESC: "
  30. start-stop-daemon --start --background --quiet --exec $DAEMON -- $DARGS
  31. echo "$NAME."
  32. ;;
  33. stop)
  34. echo -n "Stopping $DESC: "
  35. start-stop-daemon --stop --quiet --retry 2 --oknodo --exec $DAEMON -- $DARGS
  36. echo "$NAME."
  37. ;;
  38. #reload)
  39. restart|force-reload)
  40. #
  41. # If the "reload" option is implemented, move the "force-reload"
  42. # option to the "reload" entry above. If not, "force-reload" is
  43. # just the same as "restart".
  44. #
  45. echo -n "Restarting $DESC: "
  46. start-stop-daemon --stop --quiet --exec $DAEMON -- $DARGS
  47. sleep 1
  48. start-stop-daemon --start --background --quiet --exec $DAEMON -- $DARGS
  49. echo "$NAME."
  50. ;;
  51. *)
  52. N=/etc/init.d/$NAME
  53. # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
  54. echo "Usage: $N {start|stop|restart|force-reload}" >&2
  55. exit 1
  56. ;;
  57. esac
  58. exit 0