Logoj0ke.net Open Build Service > Projects > devel:subversion > subversion16 > subversion.rcsvnserve
Sign Up | Log In

File subversion.rcsvnserve of Package subversion16

x
 
1
#! /bin/sh
2
# Copyright (c) 1995-2002 SuSE Linux AG, Nuernberg, Germany.
3
# All rights reserved.
4
#
5
# /etc/init.d/svnserve
6
#   and its symbolic link
7
# /usr/sbin/rcsvnserve
8
#
9
# LSB compatible service control script; see http://www.linuxbase.org/spec/
10
# 
11
# Note: This script uses functions rc_XXX defined in /etc/rc.status on
12
# UnitedLinux (UL) based Linux distributions. If you want to base your 
13
# script on this template and ensure that it works on non UL based LSB 
14
# compliant Linux distributions, you either have to provide the rc.status
15
# functions from UL or change the script to work without them.
16
17
### BEGIN INIT INFO
18
# Provides:          svnserve
19
# Required-Start:
20
# Should-Start:      $time ypbind sendmail $syslog $remote_fs
21
# Required-Stop:     $syslog $remote_fs
22
# Should-Stop:       $time ypbind sendmail
23
# Default-Start:     3 5
24
# Default-Stop:      0 1 2 6
25
# Short-Description:  svnserve
26
# Description:        readonly access to a subversion repository
27
### END INIT INFO
28
29
30
# Note on runlevels: 
31
# 0 - halt/poweroff             6 - reboot
32
# 1 - single user           2 - multiuser without network exported
33
# 3 - multiuser w/ network (text mode)  5 - multiuser w/ network and X11 (xdm)
34
# 
35
# Note on script names:
36
# http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/scrptnames.html
37
# A registry has been set up to manage the init script namespace.
38
# http://www.lanana.org/
39
# Please use the names already registered or register one or use a
40
# vendor prefix.
41
42
43
# Check for missing binaries (stale symlinks should not happen)
44
SVNSERVE_BIN=/usr/bin/svnserve
45
test -x $SVNSERVE_BIN || exit 5
46
47
# Check for existence of needed config file and read it
48
SVNSERVE_CONFIG=/etc/sysconfig/svnserve
49
test -r $SVNSERVE_CONFIG || exit 6
50
. $SVNSERVE_CONFIG
51
52
# Source LSB init functions
53
# providing start_daemon, killproc, pidofproc, 
54
# log_success_msg, log_failure_msg and log_warning_msg.
55
# This is currently not used by UnitedLinux based distributions and
56
# not needed for init scripts for UnitedLinux only. If it is used,
57
# the functions from rc.status should not be sourced or used.
58
#. /lib/lsb/init-functions
59
60
# Shell functions sourced from /etc/rc.status:
61
#      rc_check         check and set local and overall rc status
62
#      rc_status        check and set local and overall rc status
63
#      rc_status -v     be verbose in local rc status and clear it afterwards
64
#      rc_status -v -r  ditto and clear both the local and overall rc status
65
#      rc_status -s     display "skipped" and exit with status 3
66
#      rc_status -u     display "unused" and exit with status 3
67
#      rc_failed        set local and overall rc status to failed
68
#      rc_failed <num>  set local and overall rc status to <num>
69
#      rc_reset         clear both the local and overall rc status
70
#      rc_exit          exit appropriate to overall rc status
71
#      rc_active        checks whether a service is activated by symlinks
72
#      rc_splash arg    sets the boot splash screen to arg (if active)
73
. /etc/rc.status
74
75
# Reset status of this service
76
rc_reset
77
78
# Return values acc. to LSB for all commands but status:
79
# 0   - success
80
# 1       - generic or unspecified error
81
# 2       - invalid or excess argument(s)
82
# 3       - unimplemented feature (e.g. "reload")
83
# 4       - user had insufficient privileges
84
# 5       - program is not installed
85
# 6       - program is not configured
86
# 7       - program is not running
87
# 8--199  - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
88
# 
89
# Note that starting an already running service, stopping
90
# or restarting a not-running service as well as the restart
91
# with force-reload (in case signaling is not supported) are
92
# considered a success.
93
94
case "$1" in
95
    start)
96
    echo -n "Starting svnserve "
97
    ## Start daemon with startproc(8). If this fails
98
    ## the return value is set appropriately by startproc.
99
    startproc -u "$SVNSERVE_USERID" -g "$SVNSERVE_GROUPID" -e $SVNSERVE_BIN $SVNSERVE_OPTIONS
100
101
    # Remember status and be verbose
102
    rc_status -v
103
    ;;
104
    stop)
105
    echo -n "Shutting down svnserve "
106
    ## Stop daemon with killproc(8) and if this fails
107
    ## killproc sets the return value according to LSB.
108
109
    killproc -TERM $SVNSERVE_BIN
110
111
    # Remember status and be verbose
112
    rc_status -v
113
    ;;
114
    try-restart)
115
    ## Do a restart only if the service was active before.
116
    ## Note: try-restart is not (yet) part of LSB (as of 1.2)
117
    $0 status >/dev/null &&  $0 restart
118
119
    # Remember status and be quiet
120
    rc_status
121
    ;;
122
    restart)
123
    ## Stop the service and regardless of whether it was
124
    ## running or not, start it again.
125
    $0 stop
126
    $0 start
127
128
    # Remember status and be quiet
129
    rc_status
130
    ;;
131
    force-reload)
132
133
    echo -n "Reload service svnserve "
134
    $0 stop  &&  $0 start
135
    #rc_status
136
    ;;
137
    status)
138
    echo -n "Checking for service svnserve "
139
    ## Check status with checkproc(8), if process is running
140
    ## checkproc will return with exit status 0.
141
142
    # Return value is slightly different for the status command:
143
    # 0 - service up and running
144
    # 1 - service dead, but /var/run/  pid  file exists
145
    # 2 - service dead, but /var/lock/ lock file exists
146
    # 3 - service not running (unused)
147
    # 4 - service status unknown :-(
148
    # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
149
    
150
    # NOTE: checkproc returns LSB compliant status values.
151
    checkproc $SVNSERVE_BIN
152
    # NOTE: rc_status knows that we called this init script with
153
    # "status" option and adapts its messages accordingly.
154
    rc_status -v
155
    ;;
156
    *)
157
    echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload}"
158
    exit 1
159
    ;;
160
esac
161
rc_exit
162