# Check that networking is up.
if is_yes "${NETWORKING}"; then
- if [ ! -f /var/lock/subsys/network ]; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
msg_network_down "fetchmail"
exit 1
fi
# Check that fetchmailrc exists.
[ -f /etc/fetchmailrc ] || exit 0
-RETVAL=0
-# See how we were called.
-case "$1" in
- start)
+start() {
if [ ! -f /var/lock/subsys/fetchmail ]; then
msg_starting "fetchmail"
else
msg_already_running fetchmail
fi
- ;;
- stop)
+}
+
+stop() {
if [ -f /var/lock/subsys/fetchmail ]; then
msg_stopping "fetchmail"
killproc fetchmail
rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
else
msg_not_running "fetchmail"
- fi
+ fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
;;
restart)
- $0 stop
- $0 start
- exit $?
+ stop
+ start
;;
reload|force-reload)
if [ -f /var/lock/subsys/fetchmail ]; then
killproc fetchmail -HUP
RETVAL=$?
else
- msg_not_running fetchmail >&2
+ msg_not_running fetchmail
exit 7
fi
;;