2013-05-27 02:57:04 +00:00
|
|
|
--- conserver-8.1.16/contrib/redhat-rpm/conserver.init 2003-02-28 10:06:50.000000000 +0800
|
|
|
|
+++ conserver-8.1.16-diffinit/contrib/redhat-rpm/conserver.init 2013-05-24 14:36:21.006320225 +0800
|
|
|
|
@@ -6,15 +6,63 @@
|
2011-05-03 20:29:30 +00:00
|
|
|
# description: conserver is a serial-port console daemon
|
|
|
|
# config: /etc/conserver.cf
|
|
|
|
#
|
2013-05-27 02:57:04 +00:00
|
|
|
+### BEGIN INIT INFO
|
|
|
|
+# Provides: conserver
|
|
|
|
+# Required-Start:
|
|
|
|
+# Required-Stop:
|
|
|
|
+# Default-Start: 2 3 4 5
|
|
|
|
+# Default-stop:
|
|
|
|
+# Short-Description: conserver
|
|
|
|
+# Description: Console server
|
|
|
|
+### END INIT INFO
|
|
|
|
+
|
2011-05-03 20:29:30 +00:00
|
|
|
+RHPassed()
|
|
|
|
+{
|
|
|
|
+ passed
|
|
|
|
+ echo
|
|
|
|
+}
|
|
|
|
+RHSuccess()
|
|
|
|
+{
|
|
|
|
+ success
|
|
|
|
+ echo
|
|
|
|
+}
|
|
|
|
+RHFailure()
|
|
|
|
+{
|
|
|
|
+ failure
|
|
|
|
+ echo
|
|
|
|
+}
|
|
|
|
+MStatus()
|
|
|
|
+{
|
|
|
|
+ ps ax|grep -v grep|grep /usr/sbin/conserver >& /dev/null
|
|
|
|
+ if [ "$?" = "0" ]; then
|
|
|
|
+ RVAL=0
|
|
|
|
+ echo "conserver is running"
|
|
|
|
+ else
|
|
|
|
+ RVAL=3
|
|
|
|
+ echo "consever is not running"
|
|
|
|
+ fi
|
|
|
|
+ return $RVAL
|
|
|
|
+}
|
|
|
|
|
|
|
|
-# Source function library.
|
|
|
|
-. /etc/rc.d/init.d/functions
|
|
|
|
-
|
|
|
|
-# Source networking configuration.
|
|
|
|
-. /etc/sysconfig/network
|
|
|
|
|
|
|
|
-# Check that networking is up.
|
|
|
|
-[ ${NETWORKING} = "no" ] && exit 0
|
|
|
|
+# Source function library.
|
|
|
|
+if [ -f /etc/rc.d/init.d/functions ]; then
|
|
|
|
+ . /etc/rc.d/init.d/functions
|
|
|
|
+ DAEMON=daemon
|
|
|
|
+ SUCCESS=RHSuccess
|
|
|
|
+ FAILURE=RHFailure
|
|
|
|
+ PASSED=RHPassed
|
|
|
|
+ STATUS=status
|
|
|
|
+elif [ -f /lib/lsb/init-functions ]; then
|
|
|
|
+ . /lib/lsb/init-functions
|
|
|
|
+ DAEMON=start_daemon
|
|
|
|
+ SUCCESS=log_success_msg
|
|
|
|
+ FAILURE=log_failure_msg
|
|
|
|
+ PASSED=log_warning_msg
|
|
|
|
+ STATUS=MStatus
|
|
|
|
+else
|
|
|
|
+ echo "Error, not RedHat and not lsb, do not know how to run this platform"
|
|
|
|
+fi
|
|
|
|
|
|
|
|
# make sure conserver is installed and executable
|
|
|
|
[ -x /usr/sbin/conserver ] || exit 1
|
2013-05-27 02:57:04 +00:00
|
|
|
@@ -24,23 +72,45 @@
|
2011-05-03 20:29:30 +00:00
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n "Starting conserver: "
|
|
|
|
- daemon conserver -d
|
|
|
|
- echo
|
|
|
|
+ $DAEMON /usr/sbin/conserver -o -O1 -d
|
|
|
|
touch /var/lock/subsys/conserver
|
|
|
|
+ $STATUS conserver >& /dev/null
|
|
|
|
+ if [ "$?" != "0" ]; then
|
|
|
|
+ $FAILURE
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ $SUCCESS
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
+ $STATUS conserver >& /dev/null
|
|
|
|
+ if [ "$?" != "0" ]; then
|
|
|
|
+ echo -n "conserver not running, not stopping "
|
|
|
|
+ $PASSED
|
2013-05-27 02:57:04 +00:00
|
|
|
+ exit 0
|
2011-05-03 20:29:30 +00:00
|
|
|
+ fi
|
|
|
|
echo -n "Shutting down conserver: "
|
|
|
|
killproc conserver
|
|
|
|
- echo
|
|
|
|
rm -f /var/lock/subsys/conserver
|
|
|
|
+ $STATUS conserver >& /dev/null
|
|
|
|
+ if [ "$?" == "0" ]; then
|
|
|
|
+ $FAILURE
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ $SUCCESS
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
- status conserver
|
|
|
|
+ $STATUS conserver
|
2013-05-27 02:57:04 +00:00
|
|
|
+ exit $?
|
2011-05-03 20:29:30 +00:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
- echo -n "Restarting conserver: "
|
|
|
|
- killproc conserver -HUP
|
|
|
|
- echo
|
|
|
|
+ $STATUS conserver >& /dev/null
|
|
|
|
+ if [ "$?" != "0" ]; then
|
|
|
|
+ exec $0 start
|
|
|
|
+ else
|
|
|
|
+ echo -n "Restarting conserver: "
|
|
|
|
+ killproc conserver -HUP
|
|
|
|
+ fi
|
|
|
|
+ $SUCCESS
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: conserver {start|stop|restart|status}"
|