Changes

Jump to navigation Jump to search
no edit summary
Line 1: Line 1:  
I'm not sure that the chkconfig command is required
 
I'm not sure that the chkconfig command is required
 +
 +
I know, but I love to be centos compatible--[[User:Stephdl|Stephdl]] ([[User talk:Stephdl|talk]]) 22:22, 2 October 2015 (CEST)
 +
 +
another scrip, I need to do some tests on it --[[User:Stephdl|Stephdl]] ([[User talk:Stephdl|talk]]) 22:22, 2 October 2015 (CEST)
 +
 +
#!/bin/sh
 +
#
 +
# chkconfig: - 88 10
 +
# description: Start/Stop the RADICALE server daemon
 +
# Default-Start: 2 3 4 5
 +
# Default-Stop: 0 1 6
 +
#
 +
 +
# Source function library.
 +
. /etc/rc.d/init.d/functions
 +
 +
#set the software path to run
 +
SCRIPT=/usr/bin/radicale
 +
#set the path to the configuration if needed
 +
CONFIG=/etc/radicale/config
 +
#set the name of the software to launch
 +
prog=radicale
 +
#set the user who run the software
 +
user=radicale
 +
 +
#if you don't need to set configuration files
 +
#exec="$SCRIPT"
 +
exec="$SCRIPT -C $CONFIG"
 +
 +
 +
#set the the lockfile
 +
lockfile=/var/lock/subsys/$prog
 +
#set the pid path, /var/run/$prog/ must be writable by the user
 +
pidfile=/var/run/$prog/$prog.pid
 +
 +
#stop the script if the binary and configuration files are not found
 +
[ -f $SCRIPT ] || exit 0
 +
[ -f $CONFIG ] || exit 0
 +
 +
###don't change here
 +
RETVAL=0
 +
 +
case "$1" in
 +
start)
 +
      echo -n $"Starting $prog  server: "
 +
    daemon --user=radicale --pidfile=$pidfile $exec 
 +
    RETVAL=$?
 +
    echo
 +
    [ $RETVAL -eq 0 ] && touch $lockfile
 +
    ln -s $pidfile /var/run/$prog.pid 2>/dev/null
 +
    status radicale
 +
    RETVAL=$?
 +
      ;;
 +
stop)
 +
      echo -n $"Stopping $prog server: "
 +
      killproc $SCRIPT
 +
      RETVAL=$?
 +
      echo
 +
      [ $RETVAL -eq 0 ] && rm -f $lockfile
 +
      ;;
 +
status)
 +
      status radicale
 +
      RETVAL=$?
 +
      ;;
 +
restart)
 +
      $0 stop
 +
      sleep 3
 +
      $0 start
 +
      RETVAL=$?
 +
      ;;
 +
*)
 +
      echo $"Usage: $0 {start|stop|status|restart}"
 +
      exit 1
 +
esac
 +
 +
exit $RETVAL

Navigation menu