I've created a little init.d script for CentOS (Linux).

I share it here

You just need to create a file at : /etc/init.d/maniaplanet
File Content and edit:
Code: Select all
#!/bin/bash
# maniaplanet Daemon
# chkconfig: 345 20 80
# processname: maniaplanet
#
# Created by Logistik for CentOS 6 Compatibility
# Under What The Fuck Public Licence v2
DAEMON_PATH="[b]YOUR MANIAPLANET DIRECTORY[/b]"
#e.g : "/home/tm2/TM2/"
SERVERTYPE="[b]YOUR SERVERTYPE HERE[/b]"
#e.g : "TMValley", "TMCanyon", "TMStadium"
MATCHSETTING_FILE="[b]YOUR MATCHSETTING PATH HERE[/b]"
#e.g : "MatchSettings/TMValleyA.txt"
DEDICATED_CONFIG_FILE="[b]YOUR DEDICATED CONFIG PATH HERE[/b]"
#e.g : "dedicated.cfg.txt"
DAEMON="./ManiaPlanetServer /title=$SERVERTYPE /game_settings=$MATCHSETTING_FILE /dedicated_cfg=$DEDICATED_CONFIG_FILE"
NAME=maniaplanet
DESC="maniaplanet Daemon"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
case "$1" in
start)
printf "%-50s" "Starting $NAME..."
cd $DAEMON_PATH
PID=`$DAEMON > /dev/null 2>&1 & echo $!`
(( PID = $PID + 1 ))
if [ -z $PID ]; then
printf "%s\n" "Fail"
else
echo $PID > $PIDFILE
printf "%s\n" "Ok"
fi
;;
status)
printf "%-50s" "Checking $NAME..."
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
printf "%s\n" "Process dead but pidfile exists"
else
echo "Running"
fi
else
printf "%s\n" "Service not running"
fi
;;
stop)
printf "%-50s" "Stopping $NAME"
PID=`cat $PIDFILE`
cd $DAEMON_PATH
if [ -f $PIDFILE ]; then
kill -HUP $PID
printf "%s\n" "Ok"
rm -f $PIDFILE
else
printf "%s\n" "pidfile not found"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {status|start|stop|restart}"
exit 1
esac
service maniaplanet start
Command to Stop Maniaplanet:
service maniaplanet stop
Command to restart Maniaplanet:
service maniaplanet restart
Command to check status:
service maniaplanet start
Tip: Your ManiaPlanet Server can start automatically when Dedicated server is started, just type this command in terminal:
chkconfig maniaplanet on
Give me a Thanks if i have helped you !

Levy's Pig
