/init.d/single

http://github.com/brinkman83/bashrc · Shell · 35 lines · 21 code · 4 blank · 10 comment · 1 complexity · dc13cb373c5c098a8fb95424701373e3 MD5 · raw file

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: single
  4. # Required-Start: $local_fs $all killprocs
  5. # Required-Stop:
  6. # Default-Start: 1
  7. # Default-Stop:
  8. # Short-Description: executed by init(8) upon entering runlevel 1 (single).
  9. ### END INIT INFO
  10. PATH=/sbin:/bin
  11. . /lib/lsb/init-functions
  12. do_start () {
  13. log_action_msg "Will now switch to single-user mode"
  14. exec init -t1 S
  15. }
  16. case "$1" in
  17. start)
  18. do_start
  19. ;;
  20. restart|reload|force-reload)
  21. echo "Error: argument '$1' not supported" >&2
  22. exit 3
  23. ;;
  24. stop)
  25. # No-op
  26. ;;
  27. *)
  28. echo "Usage: $0 start|stop" >&2
  29. exit 3
  30. ;;
  31. esac