/[smecontribs]/rpms/hylafax/contribs7/hylafax_init
ViewVC logotype

Contents of /rpms/hylafax/contribs7/hylafax_init

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Tue Nov 25 16:20:12 2008 UTC (16 years ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
Error occurred while calculating annotation data.
Restore

1 #!/bin/sh
2 #
3 # chkconfig: 345 95 5
4 # description: Starts and stops the HylaFAX server and queue manager \
5 # used to provide FAX services
6 #
7
8 ### BEGIN INIT INFO
9 # Provides: hylafax
10 # Required-Start: $local_fs $network $syslog
11 # Should-Start: hfaxd faxd
12 # Required-Stop:
13 # Default-Start: 3 4 5
14 # Default-Stop: 0 1 2 6
15 # Short-Description: Starts and stops the HylaFAX
16 # Description: Starts and stops the HylaFAX server and queue manager \
17 # used to provide FAX services
18 ### END INIT INFO
19
20 return_success=
21 return_failure=
22
23 # Source function library.
24 if [ -f /etc/init.d/functions ] ; then
25 . /etc/init.d/functions
26 alias START_DAEMON=daemon
27 alias STATUS=status
28 alias ACTION=action
29 elif [ -f /etc/rc.d/init.d/functions ] ; then
30 . /etc/rc.d/init.d/functions
31 alias START_DAEMON=daemon
32 alias STATUS=status
33 alias ACTION=action
34 elif [ -f /lib/lsb/init-functions ]; then
35 . /lib/lsb/init-functions
36 alias START_DAEMON=start_daemon
37 alias STATUS=suse_status
38 alias ACTION=suse_action
39 return_success=$rc_done
40 return_failure=$rc_failed
41 else
42 exit 0
43 fi
44
45
46 # HylaFAX spool directory
47 if [ -d /var/spool/hylafax ]; then
48 SPOOL=/var/spool/hylafax
49 else
50 SPOOL=/var/spool/fax
51 fi
52
53 HFAXD_ARGS=
54 FAXQ_ARGS=
55
56 # Source HylaFAX init script configuration
57 if [ -f /etc/sysconfig/hylafax ] ; then
58 . /etc/sysconfig/hylafax
59 fi
60
61 # Put Extra args first as some may be needed before ports parameters
62 if [ -n "$HFAXD_EXTRA_ARGS" ] ; then
63 HFAXD_ARGS=$HFAXD_EXTRA_ARGS
64 fi
65
66 # Bind to a specific address
67 if [ -n "$HFAXD_LISTEN" ] ; then
68 HFAXD_ARGS="$HFAXD_ARGS -l $HFAXD_LISTEN"
69 fi
70
71 if [ "$HFAXD_OLD_PROTOCOL" = "yes" ] ; then
72 HFAXD_ARGS="$HFAXD_ARGS -o 4557"
73 fi
74
75 if [ -f "$SPOOL/etc/pagermap" ] ; then
76 HFAXD_ARGS="$HFAXD_ARGS -s snpp"
77 fi
78
79 HFAXD_ARGS="$HFAXD_ARGS -i hylafax"
80
81 if [ "$SPOOL" != "/var/spool/hylafax" ] ; then
82 HFAXD_ARGS="$HFAXD_ARGS -q $SPOOL"
83 FAXQ_ARGS="$FAXQ_ARGS -q $SPOOL"
84 fi
85
86 start() {
87 check_config || exit 1
88
89 echo -n "Starting HylaFAX queue manager (faxq): "
90 START_DAEMON /usr/sbin/faxq
91 RETVAL=$?
92 if [ $RETVAL -eq 0 ]; then
93 echo -e $return_success
94 else
95 echo -e $return_failure
96 fi
97
98 echo -n "Starting HylaFAX server (hfaxd): "
99 START_DAEMON /usr/sbin/hfaxd $HFAXD_ARGS
100 RETVAL2=$?
101 if [ $RETVAL2 -eq 0 ]; then
102 echo -e $return_success
103 else
104 echo -e $return_failure
105 fi
106
107 reset_faxgetty
108
109 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && \
110 touch /var/lock/subsys/hylafax || RETVAL=1
111 return $RETVAL
112 }
113
114 stop() {
115 ACTION "Shutting down HylaFAX queue manager (faxq): " /usr/sbin/faxquit
116 RETVAL=$?
117
118 echo -n "Shutting down HylaFAX server (hfaxd): "
119 killproc hfaxd
120 RETVAL2=$?
121 if [ $RETVAL2 -eq 0 ]; then
122 echo -e $return_success
123 else
124 echo -e $return_failure
125 fi
126
127 [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && \
128 rm -f /var/lock/subsys/hylafax || RETVAL=1
129 return $RETVAL
130 }
131
132 restart() {
133 stop
134 start
135 }
136
137 suse_action() {
138 echo -n $1
139 $2
140 RETVAL=$?
141 if [ $RETVAL -eq 0 ]; then
142 echo -e $return_success
143 else
144 echo -e $return_failure
145 fi
146 return $RETVAL
147 }
148
149 suse_status() {
150 checkproc $1
151 rc_status -v
152 }
153
154 hfstatus() {
155 echo -n "HylaFAX client-server protocol server: "
156 STATUS hfaxd
157 echo -n "HylaFAX queue manager process: "
158 STATUS faxq
159 }
160
161 check_config() {
162 test -f $SPOOL/etc/setup.cache || {
163 cat<<-EOF
164
165 HylaFAX FATAL ERROR: $SPOOL/etc/setup.cache is missing!
166
167 The file $SPOOL/etc/setup.cache is not present.
168 This probably means the machine has not been setup using the
169 faxsetup(8C) command. Read the documentation on setting up
170 HylaFAX before you startup a server system.
171
172 EOF
173
174 exit 1
175 }
176 }
177
178 reset_faxgetty () {
179 pids=`pidofproc faxgetty`
180 if [ -n "$pids" ] && ps h $pids >/dev/null 2>&1; then
181 echo -n "Restarting HylaFAX modem manager (faxgetty):"
182 # will be respawned from /etc/inittab
183 killproc faxgetty
184 if [ $? -eq 0 ]; then
185 echo -e $return_success
186 else
187 echo -e $return_failure
188 fi
189 fi
190 }
191
192 case "$1" in
193 start)
194 start
195 ;;
196 stop)
197 stop
198 ;;
199 status)
200 hfstatus
201 ;;
202 restart|reload)
203 restart
204 ;;
205 condrestart)
206 [ -f /var/lock/subsys/hylafax ] && restart
207 ;;
208 *)
209 echo "Usage: $0 {start|stop|status|restart|reload|condrestart}"
210 exit 1
211 ;;
212 esac
213
214 exit $?
215

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed