Knowledgebase

Portal Home > Knowledgebase > Articles Database > Periotic Reboot


Periotic Reboot




Posted by raffo, 06-01-2009, 05:52 PM
Hello, how to configure a periodic reboot, for example, each 4h the server will be reboot automatic. i think i do configure a cron, but i can't find anything for periodic rebooting on freebsd. this is a temporary solution for a issue of php. thanks.

Posted by DamianMyerscough, 06-01-2009, 07:23 PM
Hello raffo, Try the following cron job I am sure this would be better than writing a PHP script.

Posted by mwatkins, 06-01-2009, 07:39 PM
Why reboot the entire server if the issue is PHP specific? Can't you resolve the issue by restarting particular services?

Posted by larwilliams, 06-01-2009, 07:45 PM
Yea, if it is PHP-related, simply restart Apache instead.

Posted by Kusai, 06-01-2009, 08:25 PM
cant u just restart the services ??

Posted by meeinter, 06-01-2009, 10:46 PM
we don't need reeboot we need Uptime

Posted by InstaCarma_Support, 06-02-2009, 12:37 AM
Right. Rebooting the entire server is not a great idea. Restarting the services should do the trick.

Posted by barry[CoffeeSprout], 06-02-2009, 12:54 AM
Or even better... what is the problem you are having with PHP? Maybe that can be fixed.

Posted by ZenMonk, 06-02-2009, 03:42 AM
The root cause need to addressed instead of simply rebooting which is just a temporary fix. Maybe, there are sites with high traffic on your server which does not have enough resource to handle it and there can be many other umpteen reasons.

Posted by raffo, 06-02-2009, 06:15 PM
yes, is much greate and clean and fast to restart a single service. but i don't know how to configure the restart service of php when is crashed.. so is much easey to cron a reboot. php crash each 6h. please, let me know how i can reload php each 6h or each crash.. Thanks

Posted by larwilliams, 06-02-2009, 07:06 PM
PHP doesn't run as a service. It's either via CGI or through Apache. If you are running cPanel, you can call /scripts/restartsrv_apache in the cron and it will work. Otherwise, please try the following command: /usr/local/sbin/apachectl graceful Regards, Lawrence

Posted by mwatkins, 06-02-2009, 09:10 PM
PHP runs in it's own process space when used in FastCGI mode. Perhaps the OP is doing this either via Apache or another httpd like lighttpd. roffo - what web server - httpd - are you running? If lighttpd, on FreeBSD you can stop and restart lighttpd (and thus all the php-cgi processes): /usr/local/etc/rc.d/lighttpd restart If Apache: /usr/local/etc/rc.d/apache22 restart Put whichever command is relevant to your situation in root's crontab and you are done.

Posted by raffo, 06-03-2009, 02:22 AM
I run nginx on FreeBSD. i know how restart nginz or apache.. i don't know how cron the restart each 6h.

Posted by tuxguru, 06-03-2009, 05:51 AM
Try this cron:



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read


Language:

Contact us