]>
git.proxmox.com Git - pve-sheepdog.git/blob - debian/pve-sheepdog.sheepdog.init.d
2de87448bf0663341b9fa0c00a37055baa270a6e
4 # Required-Start: $network $remote_fs $syslog cman
5 # Required-Stop: $network $remote_fs $syslog cman
6 # Default-Start: 2 3 4 5
8 # Short-Description: Sheepdog server
9 # Description: Sheepdog server
12 # Author: Proxmox Support Team <support@proxmox.com>
14 # PATH should only include /usr/* if it runs after the mountnfs.sh script
15 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
16 DESC
="Sheepdog Server" # Introduce a short description here
17 NAME
=sheepdog
# Introduce the short server's name here
18 DAEMON
=/usr
/sbin
/sheep
# Introduce the server's location here
19 SCRIPTNAME
=/etc
/init.d
/$NAME
20 PIDFILE
="/var/run/sheep.pid"
22 # Exit if the package is not installed
23 [ -x $DAEMON ] ||
exit 0
25 ROOTDIR
="/var/lib/sheepdog/"
28 # Read configuration variable file if it is present
29 [ -r /etc
/default
/$NAME ] && .
/etc
/default
/$NAME
31 if [ "$START" != "yes" ]; then
35 .
/lib
/lsb
/init-functions
38 # Function that starts the daemon/service
45 # 0 if daemon has been started
46 # 1 if daemon was already running
47 # 2 if daemon could not be started
48 ulimit -n 1024000 #avoid check_host_env(395) WARN: Allowed open files 1024 too small, suggested 1024000 warning message
49 ulimit -c unlimited
#avoid check_host_env(404) Allowed core file size 0, suggested unlimited warning message
50 DAEMON_ARGS
="--pidfile ${PIDFILE}"
51 DAEMON_ARGS
="${DAEMON_ARGS} $ROOTDIR"
53 # /path/to/meta-store,/path/to/disk1{,/path/to/disk2,...}
54 for d
in $ROOTDIR/disc
*
57 DAEMON_ARGS
="${DAEMON_ARGS},$d"
61 if [ -d "$ROOTDIR/journal" ]; then
62 DAEMON_ARGS
="${DAEMON_ARGS} -j dir=$ROOTDIR/journal,size=$JOURNALSIZE"
65 status_of_proc
-p ${PIDFILE} $DAEMON "$NAME" >/dev
/null
&& continue
66 start-stop-daemon
--start --quiet --pidfile ${PIDFILE} --exec $DAEMON -- $DAEMON_ARGS ||
return 2
72 # Function that stops the daemon/service
77 # 0 if daemon has been stopped
78 # 1 if daemon was already stopped
79 # 2 if daemon could not be stopped
80 # other if a failure occurred
82 start-stop-daemon
--stop --oknodo --retry=TERM
/20/KILL
/5 --quiet --pidfile ${PIDFILE} --exec $DAEMON ||
return 2
87 log_daemon_msg
"Starting $DESC " "$NAME"
95 log_daemon_msg
"Stopping $DESC" "$NAME"
104 status_of_proc
-p ${PIDFILE} $DAEMON "$NAME ${dir}" ||
exit 1
106 restart|force-reload
)
107 log_daemon_msg
"Restarting $DESC" "$NAME"
114 1) log_end_msg
1 ;; # Old process is still running
115 *) log_end_msg
1 ;; # Failed to start
125 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2