Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $daemonName = 'my daemon';
- $sleep = 600;
- $exit = FALSE;
- while (!$exit)
- {
- sleep($sleep);
- $mysqli = mysqli_connect('localhost', 'db_user', 'db_passwd', 'schema');
- $query = "SELECT * FROM daemons WHERE name = '" . $mysqli->real_escape_string($daemonName) . "'";
- $result = $mysqli->query($query);
- $row = mysqli_fetch_assoc($result);
- $command = $row['command'];
- $run = TRUE;
- if ($command == 'exit')
- {
- $exit = TRUE;
- $run = FALSE;
- }
- else if ($command == 'pause')
- {
- $run = FALSE;
- }
- if ($run)
- {
- /* Daemon operations... */
- }
- }
Add Comment
Please, Sign In to add comment