Skip to content

Instantly share code, notes, and snippets.

@hplc
Created March 30, 2020 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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