lsyncd.init 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. #
  3. # lsyncd
  4. #
  5. # chkconfig: - 99 20
  6. # processname: /usr/bin/lsyncd
  7. # description: Live syncing daemon
  8. ### BEGIN INIT INFO
  9. # Provides: lsyncd
  10. # Required-Start: $syslog $local_fs
  11. # Required-Stop: $syslog $local_fs
  12. # Default-Start: 2 3 4 5
  13. # Default-Stop: 0 1 6
  14. # Short-Description: start and stop lsyncd
  15. # Description: Live syncing daemon
  16. ### END INIT INFO
  17. #
  18. DAEMON=/usr/bin/lsyncd
  19. prog=`basename $DAEMON`
  20. CONFIG=/etc/lsyncd.conf.xml
  21. PIDFILE=/var/lock/subsys/lsyncd
  22. test -e $DAEMON || exit 0
  23. test -f $CONFIG || exit 0
  24. if [ -r /etc/init.d/functions ]; then
  25. . /etc/init.d/functions
  26. fi
  27. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  28. export PATH
  29. RETVAL=0
  30. start() {
  31. # Check if it is already running
  32. if [ ! -f $PIDFILE ]; then
  33. echo -n $"Starting lsyncd daemon: "
  34. daemon /usr/bin/lsyncd --pidfile $PIDFILE --conf $CONFIG
  35. RETVAL=$?
  36. [ $RETVAL -eq 0 ] && touch $PIDFILE
  37. echo
  38. fi
  39. return $RETVAL
  40. }
  41. stop() {
  42. echo -n $"Stopping lsyncd daemon: "
  43. killproc /usr/bin/lsyncd
  44. RETVAL=$?
  45. [ $RETVAL -eq 0 ] && rm -f $PIDFILE
  46. echo
  47. return $RETVAL
  48. }
  49. restart() {
  50. stop
  51. start
  52. }
  53. case "$1" in
  54. start)
  55. start
  56. ;;
  57. stop)
  58. stop
  59. ;;
  60. restart)
  61. restart
  62. ;;
  63. condrestart)
  64. if [ -f $PIDFILE ]; then
  65. restart
  66. fi
  67. ;;
  68. status)
  69. status lsyncd
  70. RETVAL=$?
  71. ;;
  72. *)
  73. echo $"Usage: $0 {start|stop|status|restart|condrestart}"
  74. RETVAL=2
  75. esac
  76. exit $RETVAL