wicd 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin wicd
  4. #
  5. # Description : Wicd bootscript
  6. #
  7. # Authors : Ragnar Thomsen - rthomsen@linuxfromscratch.org
  8. #
  9. # Version : LFS 7.1
  10. #
  11. ########################################################################
  12. ### BEGIN INIT INFO
  13. # Provides:
  14. # Required-Start:
  15. # Should-Start:
  16. # Required-Stop:
  17. # Should-Stop:
  18. # Default-Start: 2 3 4 5
  19. # Default-Stop: 0 1 6
  20. # Short-Description: Starts the wicd daemon.
  21. # Description: Starts the wicd daemon
  22. # X-LFS-Provided-By: LFS
  23. ### END INIT INFO
  24. . /lib/lsb/init-functions
  25. PIDFILE="/var/run/wicd/wicd.pid"
  26. case "${1}" in
  27. start)
  28. if [ -e $PIDFILE ]; then
  29. echo "Wicd appears to already be running."
  30. echo "If this is not the case, then remove"
  31. echo "$PIDFILE and try again..."
  32. else
  33. log_info_msg "Starting wicd daemon..."
  34. start_daemon /usr/sbin/wicd 1>/dev/null
  35. evaluate_retval
  36. fi
  37. ;;
  38. stop)
  39. log_info_msg "Stopping wicd daemon..."
  40. if [ -e $PIDFILE ]; then
  41. # Shut down wpa_supplicant and any started dhcp
  42. # clients before we kill Wicd
  43. wicd-cli -xyz 1>/dev/null
  44. kill $(cat $PIDFILE)
  45. evaluate_retval
  46. else
  47. echo "Wicd appears not to be running..."
  48. fi
  49. ;;
  50. restart)
  51. ${0} stop
  52. sleep 1
  53. ${0} start
  54. ;;
  55. status)
  56. if [ -e $PIDFILE ]; then
  57. echo "Wicd is running with pid $(cat $PIDFILE)"
  58. else
  59. echo "Wicd appears not to be running..."
  60. fi
  61. ;;
  62. *)
  63. echo "Usage: ${0} {start|stop|restart|status}"
  64. exit 1
  65. ;;
  66. esac
  67. exit 0
  68. # End wicd