sourcemod 1.13 update required us to modify the startup.sh so only one PID survives as PID_FILE parameter in srcds_run otherwise would break. also now forced to manually delete the core file after writing it to debug.log

This commit is contained in:
jenz
2026-09-22 01:53:09 +02:00
parent 89ff63dc73
commit b1932f3a7a
2 changed files with 493 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
#!/bin/sh
. ./$1.conf
service_start() {
if [ ! -f $DSPATH/$DSNAME.pid ] && [ ! -f $DSPATH/$DSGAME/$DSNAME.pid ]; then
if [ -x $DSPATH/$DSENGINE ]; then
echo "$DSPATH/$DSENGINE $DSOPTS"
$DSINTERFACE $DSPATH/$DSENGINE $DSOPTS
sleep 1
#ps -ef | grep "$DSENGINE" | grep "$DSNAME" | grep -v grep | awk '{ print $2 }' > $DSNAME.pid
ps -ef | grep "srcds_linux" | grep -- "-pidfile $DSNAME.pid" | grep -v grep | awk '{ print $2 }' > $DSNAME.pid
echo "$DSENGINE process ID written to $DSNAME.pid"
fi
else
echo "Server is already running. Stop the server first, or use restart."
fi
}
service_stop() {
if screen -list | grep -q "\.$DSNAME"; then
echo "Stopping screen session: $DSNAME"
screen -S "$DSNAME" -X quit
sleep 1
fi
rm -f $DSPATH/$DSNAME.pid
rm -f $DSPATH/$DSGAME/$DSNAME.pid
screen -wipe 1> /dev/null 2> /dev/null
}
service_restart() {
service_stop
sleep 1
service_start
}
service_status() {
if [ -f $DSPATH/$DSNAME.pid ] && [ -f $DSPATH/$DSGAME/$DSNAME.pid ]; then
echo "$DSENGINE is running on process: `cat $DSPATH/$DSNAME.pid`"
else
echo "Server is offline."
fi
}
service_watch() {
if [ `screen -wipe | grep $DSNAME | grep -v grep | awk '{print $4}'` == '(Attached)' ]; then
echo "Someone is already attached to the console of the server."
else
script /dev/null & screen -r $DSNAME
fi
}
service_clean() {
rm -rf $DSPATH/*.pid
rm -rf $DSPATH/$DSGAME/*.pid
screen -wipe 1> /dev/null 2> /dev/null
}
case "$2" in
'start')
service_start
;;
'stop')
service_stop
;;
'restart')
service_restart
;;
'status')
service_status
;;
'watch')
service_watch
;;
'clean')
service_clean
;;
*)
echo "usage $0 start|stop|restart|status|watch|clean"
;;
esac;