File: swapspace.init

package info (click to toggle)
swapspace 1.18-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 712 kB
  • sloc: ansic: 1,980; sh: 1,350; makefile: 17
file content (86 lines) | stat: -rwxr-xr-x 2,271 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /bin/sh
### BEGIN INIT INFO
# Provides:          swapspace
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Linux init script for swapspace
# Description: Starts and stops swapspace daemon, a dynamic swapspace manager
### END INIT INFO

# Swapspace is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# Swapspace is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with swapspace; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

. /lib/lsb/init-functions

set -e
PREFIX="/usr/"
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
DESC="dynamic swap manager"
NAME=swapspace
DAEMON="$PREFIX/sbin/$NAME"
PIDFILE="/var/run/$NAME.pid"

PARANOID="no"

# Exit gracefully if the package has been removed
test -x "$DAEMON" || exit 0

PIDOPT="--pidfile $PIDFILE"
#DAEMON_ARGS="--daemon $PIDOPT"
DAEMON_ARGS="-d -p"
STDOPTS="--quiet $PIDOPT"

if test "$PARANOID" = "yes" ; then
	DAEMON_ARGS = "$DAEMON_ARGS -P"
fi

STARTCMD="start-stop-daemon --start --oknodo --exec $DAEMON $STDOPTS -- $DAEMON_ARGS"
STOPCMD="start-stop-daemon --stop --oknodo $STDOPTS"


case "$1" in
  start)
	log_daemon_msg "Starting $DESC" "$NAME"
	$STARTCMD >/dev/null
	log_end_msg $?
	;;
  stop)
	log_daemon_msg "Stopping $DESC" "$NAME"
	set +e
	$STOPCMD
	exit_code=$?
	set -e
	if test "$PARANOID" = "yes" ; then
		# Make an extra attempt to clean up any remaining swapfiles
		$DAEMON $DAEMON_ARGS -e
	fi
	log_end_msg $exit_code
	;;
  reload|restart|force-reload)
    $0 stop
	$0 start
	;;
  status)
    status_of_proc -p "$PIDFILE" "$DAEMON" swapspace && exit 0 || exit $?
	;;
  *)
	echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0