Jump to content

dopefish

Members
  • Posts

    4
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

dopefish's Achievements

Newbie

Newbie (1/3)

0

Reputation

  1. thanks for the fix, can someone please commit the update to the playerbot branch?
  2. ups, my bad. pm's now work again.
  3. I use a simple "while true" oneliner for my daemons since they are running in a screen anyway, but the poster wanted to log restart times, and seemed to want a startscript for it, so I just rewrote his for him. your oneliner prints the date to stdout, but considerung the vast amount of output worldd also prints to stdout when started -> the date output is going to be hard to see I'm curious about the bad hacks and uneeded code though. I'm never too old to learn something new :-)
  4. Some suggestions: - you aren't sending the process to the background, so there is no need for the if statement (which itself is also broken since the grep will see itself in the processlist and return true) - shell scripts should generally have a .sh suffix - the shebang is missing - please use "while true" or "while :" instead of "while date" (date will generally return 0 so it will work. but it just doesn't make sense since the the loop isn't critically based on a working date binary , would be a shame if mangos doesn't start just because someone broke "date") if all you want is a simple restarter that logs when it restarted, your script wound look fine like this: #!/bin/bash Daemon="worldd" BinDir="/opt/MaNGOS/bin/" LogDir="/opt/MaNGOS/log/" if [[ $(ps -o command= -ae|egrep -c "[m]angos-${Daemon}") -gt 0 ]] then echo "mangos-${Daemon} is already running, exiting" exit 1 fi ######### End of Config ########## while true do # loop forever echo "(re)starting server at $(date +"%m-%d-%H:%M-%S")>> ${LogDir}${Daemon}_restart_log.txt nice -n 20 ${BinDir}mangos-${Daemon} sleep 5 done checking for running processes works a bit better if you have mangos configured to write pidfiles, then you just have to check if the pid in the file is actually running (e.g. by checking /proc/$pid/cmdline)
×
×
  • 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