daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Jul 15th, 2013 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # etherpad-lite - this script starts and stops the etherpad light daemon
  4. #
  5. # chkconfig: - 64 36
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 2 3 4 6
  8. # Required-Start:
  9. # description: etherpad lite is a collaboration editor
  10. # processname: node
  11. # config: /srv/etherpad-lite/settings.json
  12. # pidfile: none
  13. # lockfile: /var/lock/subsys/etherpad-light
  14.  
  15. # Source function library.
  16. . /etc/rc.d/init.d/functions
  17.  
  18. # Source networking configuration.
  19. . /etc/sysconfig/network
  20.  
  21. # Check that networking is up.
  22. [ "$NETWORKING" = "no" ] && exit 0
  23.  
  24. progname="Etherpad Lite"
  25. path="/home/etherpad/etherpad-lite"
  26. prog="/usr/local/bin/node"
  27. parameter="node_modules/ep_etherpad-lite/node/server.js"
  28. log="$path/log/error.log"
  29. conf="$path/settings.json"
  30. user="etherpad"
  31. lockfile="/var/lock/subsys/etherpad-light"
  32.  
  33. logpath=$(dirname $log)
  34.  
  35. start() {
  36.         [ -x $prog ] || exit 5
  37.         [ -f $conf ] || exit 6
  38.         [ -d $logpath ] || mkdir $logpath
  39.         [ -f $log ] || touch $log
  40.         chown $user $logpath
  41.         chown $user $log
  42.  
  43.         echo -n $"Starting $progname: "
  44.         daemon --user=$user "cd $path; $prog $parameter >>$log &"
  45.         retval=$?
  46.         echo
  47.         [ $retval -eq 0 ] && touch $lockfile
  48.         return $retval
  49. }
  50.  
  51. stop() {
  52.         echo -n $"Stopping $progname: "
  53.         killproc $prog
  54.         retval=$?
  55.         echo
  56.         [ $retval -eq 0 ] && rm -f $lockfile
  57.         return $retval
  58. }
  59.  
  60. restart() {
  61.         stop
  62.         start
  63. }
  64.  
  65. rh_status() {
  66.         status $prog
  67. }
  68.  
  69. rh_status_q() {
  70.         rh_status >/dev/null 2>&1
  71. }
  72.  
  73. case "$1" in
  74.         start)
  75.                 rh_status_q && exit 0
  76.                 $1
  77.         ;;
  78.         stop)
  79.                 rh_status_q || exit 0
  80.                 $1
  81.         ;;
  82.         restart)
  83.                 $1
  84.         ;;
  85.         status)
  86.                 rh_status
  87.         ;;
  88.         *)
  89.                 echo $"Usage: $0 {start|stop|status|restart}"
  90.                 exit 2
  91. esac
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top