Skip to content
Newer
Older
100644 122 lines (109 sloc) 3.43 KB
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
1 #! /bin/sh -e
2 #
3 # interchange.init - Interchange start-stop script
4 #
2be874e @racke create /var/run/interchange at runtime
racke authored
5 # Copyright (C) 2000,2001,2002,2003,2007,2008,2009 Stefan Hornburg (Racke) <racke@linuxia.de>
6270e14 @racke merged changes 2.2 vs 2.2.2.1
racke authored
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public
18 # License along with this program; if not, write to the Free
07f71a7 @pajamian New Free Software Foundation Address in headers of various files
pajamian authored
19 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20 # MA 02110-1301 USA.
bfdd1e4 @racke added LSB dependency info to init scripts (Closes: #469718, thanks to
racke authored
21 #
22 ### BEGIN INIT INFO
23 # Provides: interchange
24 # Required-Start: $remote_fs $syslog
25 # Required-Stop: $remote_fs $syslog
26 # Should-Start: mysql postgresql
27 # Should-Stop: mysql postgresql
28 # Default-Start: 2 3 4 5
29 # Default-Stop: 0 1 6
30 ### END INIT INFO
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
31
32 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
33 DAEMON=/usr/sbin/interchange
34 NAME=interchange
35 DESC="Interchange Server"
36
37 test -f $DAEMON || exit 0
38
39 # modes that Interchange uses
40 # possible values are
41 # --unix Unix mode only (default)
42 # --inetmode Internet mode only
43 # --unix --inetmode Unix and Internet mode
44 MODE="--unix"
45 USER=interchange
537a442 @racke don't try to start/stop Interchange when /etc/interchange/init.cfg is…
racke authored
46
47 if [ ! -f /etc/interchange/init.cfg ]; then
48 echo "ERROR: /etc/interchange/init.cfg is missing."
49 exit 1
50 fi
51
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
52 . /etc/interchange/init.cfg
53
60cb5cd @racke fixed GPG variable misnomers
racke authored
54 if [ "$GPGHOME" ]; then
fd79b4d @racke Debian packages support the selection of the GnuPG home directory
racke authored
55 export GNUPGHOME=$GPGHOME
56 fi
57
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
58 case "$1" in
59 start)
3485ca0 @racke work in progress
racke authored
60 # skip start during unfinished installation
61 if [ -f /var/run/interchange-install ]; then
62 exit 0
63 fi
2be874e @racke create /var/run/interchange at runtime
racke authored
64 # create runtime directory if necessary
65 if [ ! -d /var/run/interchange ]; then
66 mkdir -m 755 /var/run/interchange
67 chown $USER:$GROUP /var/run/interchange
68 fi
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
69 echo -n "Starting $DESC: "
70 start-stop-daemon --start --quiet --pidfile /var/run/interchange/$NAME.pid \
71 --chuid $USER --exec $DAEMON -- --serve $MODE \
72 -f /etc/interchange/interchange.cfg
73 ;;
74 stop)
d27c6e3 @racke small change in the restart logic
racke authored
75 # skip stop during unfinished installation
76 if [ -f /var/run/interchange-install ]; then
77 exit 0
78 fi
79
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
80 echo -n "Stopping $DESC: "
81
82 start-stop-daemon --stop --oknodo --pidfile /var/run/interchange/$NAME.pid
83 echo "$NAME."
84 ;;
85 #reload)
86 #
87 # If the daemon can reload its config files on the fly
88 # for example by sending it SIGHUP, do it here.
89 #
90 # If the daemon responds to changes in its config file
91 # directly anyway, make this a do-nothing entry.
92 #
93 # echo "Reloading $DESC configuration files."
94 # start-stop-daemon --stop --signal 1 --quiet --pidfile \
95 # /var/run/$NAME.pid --exec $DAEMON
96 #;;
97 restart|force-reload)
98 #
99 # If the "reload" option is implemented, move the "force-reload"
100 # option to the "reload" entry above. If not, "force-reload" is
101 # just the same as "restart".
102 #
103
104 echo -n "Restarting $DESC: "
2badd38 @racke Added --oknodo option to start-stop-daemon for restart action in the
racke authored
105 start-stop-daemon --stop --pidfile /var/run/interchange/$NAME.pid --oknodo
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
106 echo "$NAME."
107 sleep 1
108
109 start-stop-daemon --start --quiet --pidfile /var/run/interchange/$NAME.pid \
110 --chuid $USER --exec $DAEMON -- --serve $MODE \
111 -f /etc/interchange/interchange.cfg
112 ;;
113 *)
114 N=/etc/init.d/$NAME
115 # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
116 echo "Usage: $N {start|stop|restart|force-reload}" >&2
117 exit 1
118 ;;
119 esac
120
121 exit 0
Something went wrong with that request. Please try again.