PDA

View Full Version : need help with cron!



Morten5t
03-29-2008, 10:53 AM
Im having a problem... because Teamspeak is keep crashing on my server after 4 days online... which is a problem atm... the cron from cpanel doesnt work because it always come back with the "tsserver.pid cant be found'

I got to know from one of the supporters that I could make a php file that could the script, but I been searching for php script that will execute the commands, but I cant find anything, I even been asking on Teamspeak forums, but no one responded.

so im asking here any one know how to make one.

shadmego
03-30-2008, 05:43 PM
Unfortunately, I'm not familiar enough with Teamspeak to help you out with your problem, but even if I was, I would be confused by what you are asking.

Do you want to make a php script that will do what "tsserver.pid" is supposed to be doing?

What command are you using to call this file? What interpreter are you trying to use?

~regards

Morten5t
03-31-2008, 08:21 PM
sorry if I made me unclear.

The problem with the Cpanel cron is that it do not work correctly with executing "./teamspeak2-server_startscript restart" just like thru a shell access. however it just returns with an error in the mail.

so I talked to a supporter who told me that I should use a PHP file with the commands such as "./teamspeak2-server_startscript start" and what else I need, since that would work.

Only problem is that I dont know how to make a PHP file that will execute ex.

cd tss2_rc2
./teamspeak2-server_startscript restart

or

./tss2_rc2/teamspeak2-server_startscript restart

This would help keep the pressure off the server when Teamspeak or other processes are overcooking the server.

shadmego
03-31-2008, 08:30 PM
Have you tried using an absolute path in cron that points to your teamspeak script?

Something like this:



/home/account/public_html/tss2_rc2/teamspeak2-server_startscript restart

shadmego
03-31-2008, 08:36 PM
By the way ...

If you are slightly familiar with php, you can do something like the following with php to execute this script:



<?php

$command = "/path/to/teamspeak-server-script restart";

exec($command);

?>

Morten5t
04-01-2008, 06:48 PM
Thank you, I will give it a try!

Morten5t
04-10-2008, 02:13 PM
None of your ways helped, as The Cron would just return that the tsserver.pid could not be found and the php script just makes alot of errors

/home/***/2cron_ts2.php: line 1: ?php
: No such file or directory
/home/***/2cron_ts2.php: line 2:
: command not found
/home/***/2cron_ts2.php: line 3: =: command not found
/home/***/2cron_ts2.php: line 3:
: command not found
/home/***/2cron_ts2.php: line 4:
: command not found
/home/***/2cron_ts2.php: line 5: syntax error near unexpected token `$command'
/home/***/2cron_ts2.php: line 5: `exec($command); '

Morten5t
04-16-2008, 03:03 PM
i tried with placing php in front of the path. this is what i get in the email



sh: /tss2_rc2/teamspeak2-server_startscript: No such file or directory

r2b2
04-16-2008, 07:35 PM
The path will need to be /home/yourusername/tss2_rc2/...

Morten5t
04-17-2008, 03:24 PM
ok thank you will try

dob99
04-18-2008, 05:15 PM
I'm not familiar with TeamSpeak either, but it looks like the script, when started with "restart" as the parameter, expects that it is already running and it is not (the pid file is missing). If all you want to do is ensure that it is running, you could try using "start" instead. If it's already running, you'll get an error saying that it's running (I presume), but you don't really care.

Incidentally, assuming this is the case, I don't think simply calling it from PHP is going to help. You could, however, check if the pid file is there and if it's not, call the script with "start". Otherwise, call it with "restart".