]> git.pld-linux.org Git - packages/hylafax.git/blame - hylafax-init
- adapter, cleanups
[packages/hylafax.git] / hylafax-init
CommitLineData
ec4247b5
TO
1#! /bin/sh
2#
3# hylafax, v 1.2 2001/01/10 Christian Zoffoli <czoffoli@linux-mandrake.com>
4#
5# chkconfig: 12345 97 05
6# description: HylaFAX(tm) is a sophisticated enterprise-strength fax \
7# package for class 1 and 2 fax modems on unix systems. \
8# This init script is the preferred way to start HylaFAX,\
9# but does not, by default, activate any modems. Consult \
10# the faxgetty(8) and faxmodem(8) man pages for more info.
11#
12
13SPOOL=/var/spool/fax
14
15# Source networking configuration.
16. /etc/sysconfig/network
17
18# Check that networking is up.
19[ ${NETWORKING} = "no" ] && exit 0
20
21# Source function library.
22if [ -f /etc/init.d/functions ] ; then
23 . /etc/init.d/functions
24elif [ -f /etc/rc.d/init.d/functions ] ; then
25 . /etc/rc.d/init.d/functions
26else
27 exit 0
28fi
29
30checkvar() {
31 if [ ! $1 ]; then
32 echo -n -e "HylaFAX ERROR (old setup.cache) please run faxsetup -server\n"
33 exit 1
34 fi
35
36 if [ $1 = "yes" -o $1 = "1" ]; then
37 return 0
38 fi
39 return 1
40}
41
42check_config() {
43 test -f $SPOOL/etc/setup.cache || {
44 cat<<-EOF
45
46 HylaFAX FATAL ERROR: $SPOOL/etc/setup.cache is missing!
47
48 The file $SPOOL/etc/setup.cache is not present.
49 This probably means the machine has not been setup using the
50 faxsetup(1M) command. Read the documentation on setting up
51 HylaFAX before you startup a server system.
52
53 EOF
54
55 return 1
56 }
57
58 # Loading Config
59 PATH_SAVE=$PATH
60 . $SPOOL/etc/setup.cache
61 PATH=$PATH_SAVE:$PATH
62
63 return 0
64}
65
66start() {
67 local RETVAL=0
68 local RETVAL2=0
69
70 OPTS="-i hylafax"
71 if checkvar $HFAXD_OLD_PROTOCOL
72 then
73 OPTS="$OPTS -o 4557"
74 OUT=" OLD Protocol"
75 fi
76
77 if checkvar $HFAXD_SNPP_SERVER
78 then
79 OPTS="$OPTS -s snpp"
80 if [ "$OUT" != "" ]; then
81 OUT="$OUT - "
82 fi
83 OUT="$OUT SNPP"
84 fi
85
86 if [ $OUT ]; then
87 OUT="( $OUT )"
88 fi
89
90
91 if checkvar $FAXQ_SERVER
92 then
621586c3 93 msg_starting "HylaFAX queue manager"
ec4247b5
TO
94 daemon faxq
95 RETVAL=$?
ec4247b5
TO
96 fi
97
98 if checkvar $HFAXD_SERVER
621586c3
AM
99 then
100 msg="HylaFAX server"
101 [ -n "$OUT" ] && msg="$msg $OUT"
102 msg_starting "HylaFAX server"
ec4247b5
TO
103 daemon hfaxd $OPTS
104 RETVAL2=$?
ec4247b5
TO
105 fi
106
621586c3 107 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/hylafax || RETVAL=1
ec4247b5
TO
108
109 return $RETVAL
110}
111
112stop() {
113 local RETVAL=0
114 local RETVAL2=0
115
621586c3
AM
116 msg_stopping "HylaFAX queue manager"
117 daemon /usr/sbin/faxquit
ec4247b5 118 RETVAL=$?
ec4247b5 119
621586c3 120 msg_stopping "HylaFAX server"
ec4247b5
TO
121 killproc hfaxd
122 RETVAL2=$?
ec4247b5
TO
123
124 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/hylafax || RETVAL=1
125 return $RETVAL
126}
127
128faxgettyreset() {
129 if pidofproc faxgetty > /dev/null
130 then
621586c3
AM
131 msg_starting "FaxGetty restart process"
132 killproc faxgetty
133 msg_starting "FaxGetty restart process (init reload)"
134 daemon init q
ec4247b5
TO
135 fi
136
137 return 0
138}
139
140restart() {
141 stop
142 start
ec4247b5
TO
143 faxgettyreset
144}
145
c79d82c1 146hstatus() {
ec4247b5
TO
147 status hfaxd
148 status faxq
149}
150
151
152check_config || exit 1
153
154case "$1" in
155 start)
156 start
157 ;;
158 stop)
159 stop
160 ;;
161 restart|reload)
162 restart
163 ;;
164 status)
c79d82c1 165 hstatus
ec4247b5
TO
166 ;;
167 condrestart)
168 [ -f /var/lock/subsys/hylafax ] && restart
169 ;;
170 faxgettyreset)
171 faxgettyreset
172 ;;
173 *)
174 echo "Usage: $0 { start | stop | status | restart | condrestart | faxgettyreset }"
175 exit 1
176 ;;
177esac
178
179exit 0
180
181
This page took 0.089336 seconds and 4 git commands to generate.