简体   繁体   中英

cron/wget - Run page every 5 hours and 30 minutes

I need help with 2 things. I'm creating a PHP page that restarts a game server every 6 hours through sending an RCON command (#restart) and I would like to have that page auto-refresh (Change case eg http://mydomain.com/restart.php?cmd=#say&timeleft=30 and send another RCON Command to the server (#say) that says "Server restart in 30 minutes" at first, then the second time it says "Server restart in 10 minutes" and so on for 5 minutes and 1 minute. And when that time has passed (Approx 30 minutes), I want the page to send the restart command. I'm guessing that I need to set a cron job that runs the page with a 5 hour and 30 minute interval.

I have the PHP section done (RCON library and the commands aswell as cases (eg http://mydomain.com/restart.php?cmd=#say&timeleft=30 )) I have yet to figure out how to do this in PHP, or do I need to do it in jQuery or AJAX or something? Thanks in advance! Regards, Tom.

What you need to do is post a command that specifies the time for restart.. When you visit the page it should check if a restart is imminent, then display restart time - current time.

You can then just cron job the restart every 6 hours:

* */6 * * * wget http://mydomain.com/restart.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM