Results 31 to 36 of 36
Open the server = to start it;
Anti-crash is this i mean the crontab becouse when it goes down it will start again so......
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-26-2012 #31Just Joined!
- Join Date
- May 2012
- Posts
- 78
Open the server = to start it;
Anti-crash is this i mean the crontab becouse when it goes down it will start again so...
- 05-27-2012 #32Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
if you want to start it, you should just be able to execute the cronjob manually - that is the whole point after all. i don't remember the path, but cd to where the script is located (somewhere in your home dir, i think), and execute it:
i think that was the name of the script. that should start it up, unless the script detects that it is already running. if you created the cronjob, then you should see that log in /tmp/ getting overwritten every 5 minutes, with the output of the script.Code:./ts-cron.sh
Last edited by atreyu; 05-27-2012 at 04:28 AM. Reason: typo
- 05-27-2012 #33Just Joined!
- Join Date
- May 2012
- Posts
- 78
ITS WORKING!!!!
THANKS
THANKS
THANKS
just a question now if i want to do this with an other server for example other ts3 server localized in /home/joaogl/Documents/ts3/ts32/
so in this case we do:
in the file...Code:[joaogl@localhost ~]$ nano /home/joaogl/Documents/ts3/ts32/ts2-cron.sh [joaogl@localhost ~]$ chmod +x /home/joaogl/Documents/ts3/ts32/ts2-cron.sh [joaogl@localhost ~]$
Code:#!/bin/bash D1=$(readlink -f "$0") BINARYPATH="$(dirname "${D1}")" cd "${BINARYPATH}" LIBRARYPATH="$(pwd)" if [ -e "ts3server_linux_x86" ]; then BINARYNAME="ts3server_linux_x86" elif [ -e "ts3server_linux_amd64" ]; then BINARYNAME="ts3server_linux_amd64" elif [ -e "ts3server_freebsd_x86" ]; then BINARYNAME="ts3server_freebsd_x86" elif [ -e "ts3server_freebsd_amd64" ]; then BINARYNAME="ts3server_freebsd_amd64" else echo "Could not locate binary file, aborting" exit 5 fi echo "TeamSpeak binary: $BINARYNAME" pid=$(/sbin/pidof -x $BINARYNAME) if [ -n "$pid" ]; then echo "TeamSpeak (pid $pid) is running" exit 0 else echo "TeamSpeak is not running" fi printf "Starting TeamSpeak: " cd /home/joaogl/Documents/ts3/ts32/ sh ./ts3s.sh start rc=$? if [ $? -eq 0 ]; then echo OK else echo FAILED fi exit $rc
than
but know lets see if i can do it...Code:[joaogl@localhost ~]$ chmod +x /home/joaogl/Documents/ts3/ts32/ts-cron.sh [joaogl@localhost ~]$
thanCode:[joaogl@localhost ~]$ crontab -e
Code:*/5 * * * * /home/joaogl/Documents/ts3/ts3/ts-cron.sh > /tmp/tr-cronjob.log 2>&1 */5 * * * * /home/joaogl/Documents/ts3/ts3/ts2-cron.sh > /tmp/tr-cronjob2.log 2>&1
- 05-27-2012 #34Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
That won't work if the name of the binary is the same as in the other server. is that want you really want - to run two instances of the same server/binary? if that is so (and you are able to run two instances simultaneously), then you can still use this approach, you just have to change how you are getting the PID of the daemon.
What you could do is use pidof to get the pids of the binaries that are running, then use ps to list just those pids, and grep their output for the path that the scripts reside in - that's how you can tell which server is which.
here is untested example:
Code:pids=$(pidof <binary_name>) for pid in $pids; do ps auxww|grep <script_path> done
- 05-28-2012 #35Just Joined!
- Join Date
- May 2012
- Posts
- 78
just to know and to stop completly how can i do it? becouse if i stop the server it will start again
- 05-29-2012 #36Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
heh, yeah that could be annoying. for now, you'll have to stop the cron daemon (as root):
The reason why this is not ideal is b/c now *all* processes that are controlled by cron will not run, not just your TS server.Code:service crond stop
ideally, you could manage this a better. one way would be to remove it from cron and make it a true stand-alone daemon (this is what I'd do). another way (shorter path to completion) would be to use a "control" file (e.g., ~/ts.PAUSE) that your cron script would look for every time it is run, and if it exists - simply exit, instead of starting. then when you want to run the script again, just remove ~/ts.PAUSE and cron will start it up as normal.


Reply With Quote

