Topic: config not existing
I am using an init script with Ubuntu 8.10. Everytime I try to run it I get an error saying that the config file does not exist. I have tried just putting it in the TWSERVER_DIR folder and also tried putting it into a config folder inside of the folder. Any ideas?
Here is my init script:
#! /bin/sh -e
# Copyright (c) 2008 Stas Sushkov (stas@nerd.ro)
# Released under GPL 2.0 (http://creativecommons.org/licenses/GPL/2.0/)
# Author: Stas Sushkov, Sept. 2008
### BEGIN INIT INFO
# Provides: teeworlds-server
# Required-Start: $network
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: teeworlds-server daemon, providing teeworlds server administration
# Description: Teeworlds is an online multi-player plat?form 2D shooter.
# teeworlds-server is a server for Teeworlds game.
### END INIT INFO
# Used variables
TWSERVER_BIN_DIR=/opt/games/teewars
TWSERVER_DIR=/var/run/teewars
TWSERVER_CONFIG=teeworlds_srv.cfg
TWSERVER_NAME=teeworlds_srv
TWSERVER_OPTS="-q -f $TWSERVER_DIR/$TWSERVER_CONFIG"
TWSERVER_PIDFILE=$TWSERVER_DIR/$TWSERVER_NAME.pid
# Loading init-functions
. /lib/lsb/init-functions
# Check for missing binaries
test -x $TWSERVER_BIN_DIR/$TWSERVER_NAME || { echo "$TWSERVER_BIN_DIR/$TWSERVER_NAME not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
test -r $TWSERVER_DIR/$TWSERVER_CONFIG || { echo "$TWSERVER_DIR/$TWSERVER_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
case "$1" in
start)
log_begin_msg "Starting Teeworlds Server..."
umask 002
if start-stop-daemon -v --start --background \
--pidfile $TWSERVER_PIDFILE --make-pidfile \
-d $TWSERVER_DIR \
--chuid games:games \
--exec $TWSERVER_BIN_DIR/$TWSERVER_NAME -- $TWSERVER_OPTS; then
log_end_msg 0
else
log_end_msg $?
fi
;;
stop)
log_begin_msg "Stopping Teeworlds Server..."
if start-stop-daemon --stop \
--pidfile $TWSERVER_PIDFILE; then
log_end_msg 0
else
log_end_msg $?
fi
;;
restart|force-reload)
"$0" stop && "$0" start
;;
*)
echo "Usage: /etc/init.d/teeworlds-server {start|stop|restart}"
exit 1
;;
esac
exit 0