Hi
I like to make a cs2d service for linux
so i mean this!
/etc/init.d/cs2d start
The CS2D server is running now!
if i like to stop the server
/etc/init.d/cs2d stop
then restart server
/etc/init.d/cs2d restart
how can i start?
bash:/etc/init.d# ls -l
-rwxr-xr-x 1 root root 9284 Aug 13 2001 functions
-rwxr-xr-x 1 root root 4984 Sep 5 00:18 halt
-rwxr-xr-x 1 root root 5528 Nov 5 09:44 firewall
-rwxr-xr-x 1 root root 1277 Sep 5 21:09 keytable
-rwxr-xr-x 1 root root 487 Jan 30 2001 killall
-rwxr-xr-x 1 root root 7958 Aug 15 17:20 network
-rwxr-xr-x 1 root root 1490 Sep 5 07:54 ntpd
-rwxr-xr-x 1 root root 2295 Jan 30 2001 rawdevices
-rwxr-xr-x 1 root root 1830 Aug 31 09:29 httpd
-rwxr-xr-x 1 root root 1311 Aug 15 14:18 syslog
#!/bin/sh
#
# /etc/init.d/cs2d
# Subsystem file for CS2D server.
#
# chkconfig: 2345 95 05
# description: CS2D server daemon
#
# processname: cs2dserver
# config: /etc/cs2d/cs2d.conf
# config: /etc/sysconfig/cs2d
# pidfile: /var/run/cs2d.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Pull in sysconfig settings.
[ -f /etc/sysconfig/cs2d ] && . /etc/sysconfig/cs2d
RETVAL=0
prog="CS2D"
# Here you put your software's specific command.
start() {
echo -n $"Starting $prog:"
# Here you put your software's specific command.
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/$prog
echo
}
stop() {
echo -n $"Stopping $prog:"
# Here you put your software's specific command.
killproc $prog -TERM
RETVAL=$?
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/$prog
echo
}
reload() {
echo -n $"Reloading $prog:"
killproc $prog -HUP
RETVAL=$?
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
condrestart)
if [ -f /var/lock/subsys/$prog ] ; then
stop
# avoid race
sleep 3
start
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
RETVAL=1
esac
exit $RETVAL
PARAMS=""
PARAMS=-realport
su $user -c "cd $DIR; screen -m -d -S cs2d ./$DAEMON $PARAMS"