Lobby event manager, a PHP script for running via cronjobs #699
Replies: 2 comments 2 replies
|
Good work, I don't think it's too janky either, regexp is how to do this as parsing it and re-saving as json would kill the original structure and comments. - // Save the file
- file_put_contents($configFilename, $newContent);
+ if ($newContent !== $config) {
+ // Save the file
+ file_put_contents($configFilename, $newContent);
+
+ // Send the reload signal to newserv and update the event,
+ // but only if the process is running
+ $newservPID = intval(trim(shell_exec('pidof newserv')));
+ if ($newservPID !== 0) posix_kill($newservPID, SIGUSR1);
+ } |
|
How to run this daily at 00:00 in Linux, do On Windows, you can create a daily task in the Task Scheduler (type |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
A while ago I made a php script to handle lobby events by itself via a cronjob, I decided to share it for those who may need one.
Though, it's full of jank and cursed code because it assumes config.json was copied from the example and comments are still in there, so I had to get creative.
Edit your schedule as needed, just be sure to leave the
noneevent at the end of the array so lobbies restore themselves to normal when an event ends.All reactions