#!/bin/bash
#
# utvpnd Startup script for the utvpn Server
#
### BEGIN INIT INFO
# chkconfig: 345 88 16
# Default-Start: 3 5
# Deafult-Stop: 0 1 2 6
# Required-Start: $network $syslog sshd
# Required-Stop:
# description: utvpn server.
# processname: utvpnserver
# pidfile: -------------------- /var/run/utvpn.pid
### END INIT INFO
UTVPNSETUP=/usr/bin/utvpnserver
case "$1" in
start)
${UTVPNSETUP} start
;;
status)
PLIST=`ps -C utvpnserver | tail -n 1`
running=false
for i in ${PLIST}
do
if [ "utvpnserver" = $i ]; then
running=true
fi
done
if [ $running = true ]; then
echo "utvpnserver is running"
else
echo "tuvpnserver is stopped"
fi
;;
stop)
${UTVPNSETUP} stop
;;
*)
echo "Usage: /etc/init.d/utvpnd {start|stop|status}"
exit 1
;;
esac
exit 0
こいつを、/etc/init.d/ 下にコピーして
$ chmod 755 /etc/init.d/utvpnd
$ chcon system_u:object_r:initrc_exec_t /etc/init.d/utvpnd
$ chkconfig --add utvpnd
$ chkconfig utvpnd on
といったあたりで、OKだろう。動作確認は
$ service utvpnd start
$ service utvpnd status
$ service utvpnd stop
$ service utvpnd status
って感じです。
0 件のコメント:
コメントを投稿