Skip to content

Instantly share code, notes, and snippets.

@hplc
Created March 30, 2020 12:36
Show Gist options
  • Save hplc/439b70419802f8e7a67b925fb2390f0c to your computer and use it in GitHub Desktop.
Save hplc/439b70419802f8e7a67b925fb2390f0c to your computer and use it in GitHub Desktop.
Monitor atd service and restart it if not running.
#!/usr/bin/php
<?php
$cmd = '/sbin/service atd';
$atd = `$cmd status`;
// var_dump($atd);
if (! preg_match('/is running/', $atd))
{
$result = `$cmd start`;
echo $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment