-
Notifications
You must be signed in to change notification settings - Fork 3
/
engine-check.php
33 lines (25 loc) · 1.37 KB
/
engine-check.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/php -q
<?php
error_reporting(E_ALL);
for($counter=0 ; $counter <30; $counter++) {
$startResult = trim(shell_exec("ps ax | grep kabook-acct-engine-start | grep php -c"));
if( $startResult === '2') {
syslog(LOG_INFO,"< KABOOK ENGINE CHECK > - KABOOK ACCT START is running ... [{$counter}]");
echo "KABOOK ACCT START is running ... [{$counter}]\n";
} else {
syslog(LOG_INFO,"< KABOOK ENGINE CHECK > - KABOOK ACCT START is stopped... trying to start it now... [{$counter}]");
echo "KABOOK ACCT START is stopped... trying to start it now... [{$counter}]\n";
shell_exec('/usr/bin/php /opt/kabook-radius/kabook-acct-engine-start.php > /dev/null 2>/dev/null &');
}
sleep(1);
$stopResult = trim(shell_exec("ps ax | grep kabook-acct-engine-stop | grep php -c"));
if( $stopResult === '2') {
syslog(LOG_INFO,"< KABOOK ENGINE CHECK > - KABOOK ACCT STOP is running ... [{$counter}]");
echo "KABOOK ACCT STOP is running ... [{$counter}]\n";
} else {
syslog(LOG_INFO,"< KABOOK ENGINE CHECK > - KABOOK ACCT STOP is stopped... trying to start it now... [{$counter}]");
echo "KABOOK ACCT STOP is stopped... trying to start it now... [{$counter}]\n";
shell_exec('/usr/bin/php /opt/kabook-radius/kabook-acct-engine-stop.php > /dev/null 2>/dev/null &');
}
sleep(1);
}