For a current project i need when a variable changes for it then to execute a couple of commands. The current code i have is: (code is in php)
function get_num_clients()
{
$wlan0_clients = exec('iw dev wlan0 station dump | grep Station | wc -l');
if(isset($wlan0_clients)){
if ($wlan0_clients == "0") {
return $wlan0_clients;
} else{
exec('arp -a > /pinapple/email_log.txt');
exec('/tmp/emailbash.sh');
return $wlan0_clients;
}
}
}
As far as i can see it should do it. The purpose of this code is for the result to be sent to a status bar on a php index page which it does but when it doesnt == 0 the rest of the statement isnt processed!
any help would be great. Thanks, Mark