mercredi 20 février 2019

If statement not acting how it should do

In a project i am currently doing it involves using an if statement that sends an email if a condition equals 1. The issue with the statement is that although it sends email it sends three then waits then sends another three.

The waiting is what i want but i cant wrap my head round why it is sending three and just one email at a time.

function get_num_clients()
{
    $wlan0_clients = exec('iw dev wlan0 station dump | grep Station | wc -l');

    if($wlan0_clients == "1"){


        exec('arp -n');
        sleep(5);
        exec('cat /proc/net/arp > /pineapple/email_log.txt');
        sleep(5);
        exec('/pineapple/emailbash.sh');
        sleep(5);
        exec('> /pineapple/email_log.txt');
        sleep(285);

    }

}

This is the statement that i have and the bash script just has the code to send the email. Any help would be great.

Mark

Aucun commentaire:

Enregistrer un commentaire