fwnn/rcfwnn

91 lines
2.1 KiB
Bash

#! /bin/sh
# Copyright (c) 1996, 2000 S.u.S.E. GmbH Fuerth, Germany. All rights reserved.
#
# Author: Mike Fabian <mfabian@suse.de>, 2000
#
# /etc/init.d/fwnn
#
### BEGIN INIT INFO
# Provides: fwnn
# Required-Start: $network $named
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Free Wnn Kanji Server used for input of Japanese
### END INIT INFO
. /etc/rc.status
FREE_WNN_BIN=/usr/bin/jserver
test -x $FREE_WNN_BIN || exit 5
# First reset status of this service
rc_reset
if [ ! -f /etc/FreeWnn/ja/jserverrc ] ; then
echo "can't find /etc/FreeWnn/ja/jserverrc"
# program is not configured
exit 6
fi
case "$1" in
start)
echo -n "Starting Free Wnn Kanji Server"
if test -e /tmp/jd_sockV4 ; then
rm /tmp/jd_sockV4
fi
# redirect message
# "startproc: startproc: signal catched /usr/bin/jserver: Terminated
# to /dev/null
startproc -u wnn -q -t 1 $FREE_WNN_BIN > /dev/null 2>&1
rc_status -v
;;
stop)
echo "Shutting down Free Wnn Kanji Server"
# don't use 'wnnkill', because this doesn't kill jserver
# if there are still clients.
killproc -TERM $FREE_WNN_BIN
rc_status -v
if test -e /tmp/jd_sockV4 ; then
rm /tmp/jd_sockV4
fi
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
$0 stop && $0 start
rc_status
;;
reload)
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for Free Wnn Kanji Server: "
checkproc $FREE_WNN_BIN
rc_status -v
;;
full-status)
$0 status
rc_status
if test -x /usr/bin/wnnstat ; then
/usr/bin/wnnstat
else
echo "Full status not available, can't start \`/usr/bin/wnnstat'"
fi
;;
*)
echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status|full-status}"
exit 1
;;
esac
rc_exit