最近我的服务器假设了bt服务器
下面是bt服务器的rc启动脚本
[code:1]
#!/bin/bash
#
# bnetd Script to control the Unix Bttrack Daemon
#
# Author: Hakan Tandogan <[email protected]>
#
# chkconfig: 2345 21 79
# description: bnetd is a Unix clone of the Battle.net Daemon
# ps -efw | grep 'bttrack.py' | grep -v grep | awk '{print $2}' | xargs kill && killall python || \echo "If BT not stoped,Please kill it by hand"
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
if [ -f /var/lock/subsys/bttrack ]; then
echo "BT is already started!"
else
/var/lib/bt/bttrack.py --port 6969 --dfile ./dstate >> /var/log/bttrack.log &
touch /var/lock/subsys/bttrack
echo "BT started."
fi
;;
stop)
if [ -f /var/lock/subsys/bttrack ]; then
ps -efw | grep 'bttrack.py' | grep -v grep | awk '{print $2}' | xargs kill || echo "If BT not stopped,Please kill it by hand!"
rm -f /var/lock/subsys/bttrack
echo "BT stopped."
else
echo "BT is aleady stopped!"
fi
;;
[code:1]
#!/bin/bash
#
# bnetd Script to control the Unix Bttrack Daemon
#
# Author: Hakan Tandogan <[email protected]>
#
# chkconfig: 2345 21 79
# description: bnetd is a Unix clone of the Battle.net Daemon
# ps -efw | grep 'bttrack.py' | grep -v grep | awk '{print $2}' | xargs kill && killall python || \echo "If BT not stoped,Please kill it by hand"
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
if [ -f /var/lock/subsys/bttrack ]; then
echo "BT is already started!"
else
su - python -c "/var/lib/bt/bttrack.py --port 6969 --dfile ./dstate >> /var/log/bttrack.log & "
touch /var/lock/subsys/bttrack
echo "BT started."
fi
;;
stop)
if [ -f /var/lock/subsys/bttrack ]; then
ps -efw | grep 'bttrack.py' | grep -v grep | awk '{print $2}' | xargs kill || echo "If BT not stopped,Please kill it by hand!"
rm -f /var/lock/subsys/bttrack
echo "BT stopped."
else
echo "BT is aleady stopped!"
fi
;;