Jump to content

Recommended Posts

  • 40 years later...
Posted

Agreed. Screen is what I use. You can try this script to start up mangosd and realmd in the background.

note* rename mangos-world to mangosd and mangos-realmd to realmd.

Other than this code, you can try to use the 'nohup' command:

nohup ./mangos-world &

nohup ./mangos-realmd &

version=0.1.9

MANGOSDIR=/opt/mangos/

case "$1" in

"")

echo "${0##*/} version ${version}, Author: Weedy"

echo "Usage: ${0##*/} <options>" # No command-line parameters,

echo "" # or first parameter empty.

echo "Normal Options:"

echo " start stop restart"

exit $E_PARAM

;;

"start")

cd $MANGOSDIR

screen -dmS realmd ./bin/realmd

screen -dmS mangosd ./bin/mangosd

monitorMangosdPid=`ps ax | awk '($6 ~ /monitor-mangosd/) { print $1 }'`

if test "$monitorMangosdPid" = ""

then

screen -dmS monitor-mangosd ./src/mangosd/monitor-mangosd

fi

sleep 3

realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`

mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`

if test "$realmdPid" = ""

then

echo "Realmd failed to start"

fi

if test "$mangosdPid" = ""

then

echo "Mangosd failed to start"

fi

echo "Mangos is now online"

;;

"stop")

realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`

mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`

runMangosdPid=`ps ax | awk '($6 ~ /run-mangosd/) { print $1 }'`

if test "$realmdPid" != ""

then

kill $realmdPid

wait $realmdPid >/dev/null 2>&1

fi

if test "$mangosdPid" != ""

then

(sleep 1; echo 'USER EDIT_ME_LEVEL3_GM'; sleep 1; echo 'PASS EDIT_ME_TO'; sleep 1;echo 'broadcast Server shuting down - 30s .save warning'; sleep 15; echo 'broadcast Server shuting down - 15s .save warning'; sleep 15; echo 'broadcast Server offline;-)'; sleep 1; echo 'exit'; sleep 1 ) | telnet localhost 34226

wait $mangosdPid >/dev/null 2>&1

fi

if test "$runMangosdPid" != ""

then

kill $runMangosdPid

wait $runMangosdPid >/dev/null 2>&1

fi

sleep 3

echo "Mangos is now offline :-("

;;

"restart")

realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`

mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`

runMangosdPid=`ps ax | awk '($6 ~ /run-mangosd/) { print $1 }'`

if test "$realmdPid" != ""

then

kill $realmdPid

wait $realmdPid >/dev/null 2>&1

fi

if test "$mangosdPid" != ""

then

(sleep 1; echo 'USER EDIT_ME_LEVEL3_GM'; sleep 1; echo 'PASS EDIT_ME_TO'; sleep 1;echo 'broadcast Server restarting - 30s .save warning'; sleep 15; echo 'broadcast Server restarting - 15s .save warning'; sleep 15; echo 'broadcast Server offline;-)'; sleep 1; echo 'exit'; sleep 1 ) | telnet localhost 34226

wait $mangosdPid >/dev/null 2>&1

fi

if test "$runMangosdPid" != ""

then

kill $runMangosdPid

wait $runMangosdPid >/dev/null 2>&1

fi

echo "Mangos is now offline, restarting;-)"

cd $MANGOSDIR

screen -dmS realmd ./bin/realmd

screen -dmS mangosd ./bin/run-mangosd

sleep 3

realmdPid=`ps ax | awk '($5 ~ /realmd/) { print $1 }'`

mangosdPid=`ps ax | awk '($5 ~ /mangosd/) { print $1 }'`

if test "$realmdPid" = ""

then

echo "Realmd failed to start"

fi

if test "$mangosdPid" = ""

then

echo "Mangosd failed to start"

fi

echo "Mangos is now online"

;;

esac

exit $?

Posted

Can somebody tell me the commands to start server using screen or give me the guide ???

i didn't use screen before this.

I have centos server os ( not desktop!) if this can help.

Thanks !

Posted

if you use bash shell, there is a disown command, works on already started tasks to.

edit: for starting tasks, better is ^^ nohup command, but if task already started, then Ctrl+Z, bg, disown.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use