Advertising
Paste Description for BF2Server init scrip
BF2Server init script
- BF2Server init scrip
- Saturday, February 17th, 2007 at 7:53:16pm UTC
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: battlefield
- # Required-Start: networking
- # Required-Stop:
- # Default-Start: 2 3 4 5
- # Default-Stop: S 0 1 6
- # Short-Description: Battlefield Server Daemon
- # Description: Starts/Stops/Restarts the Battlefield2 Server Daemon
- ### END INIT INFO
- set -e
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/bf2server/mono-1.1.12.1/bin
- DESC="Battlefield Server"
- NAME=bf2server
- USER=bf2server
- DIR=/home/bf2server/bf2
- DAEMON=mono
- PIDFILE=/var/run/$NAME.pid
- SCRIPTNAME=/etc/init.d/$NAME
- ARGUMENTS="$DIR/bf2ccd.exe"
- # Gracefully exit if the package has been removed.
- # moot
- #test -x "$DAEMON" # || exit 0
- d_start() {
- # start-stop-daemon --start --quiet \
- # --chuid $USER \
- # --chdir $DIR \
- # --exec "$DAEMON $ARGUMENTS" \
- # > /dev/null \
- # || echo -n " already running"
- echo -en "running [$DAEMON $ARGUMENTS] "
- $DAEMON $ARGUMENTS &> /dev/null &
- echo "$!" | tee $PIDFILE.my
- }
- d_stop() {
- # start-stop-daemon --stop --quiet \
- # --chuid $USER \
- # --chdir $DIR \
- # --exec "$DAEMON $ARGUMENTS" \
- # || echo -n " not running"
- kill -SIGTERM $(cat $PIDFILE.my)
- }
- case "$1" in
- start)
- echo -n "Starting $DESC: $NAME"
- d_start
- echo "."
- ;;
- stop)
- echo -n "Stopping $DESC: $NAME"
- d_stop
- echo "."
- ;;
- restart|force-reload)
- echo -n "Restarting $DESC: $NAME"
- d_stop
- sleep 15
- d_start
- echo "."
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
- exit 3
- ;;
- esac
- exit 0
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.