1.

Solve : Command Problems?

Answer»

I am running a SCRIPT with an IF statement but I need it to wait 45seconds before it starts. But with the sleep there it works but skips my if statement for some REASON and shuts down even though firefox is open. Any thoughts?

Code: [Select]#!/bin/sh --
sleep 45s
if [ ` pidof firefox-bin` ]; then
sleep 15s
fi
sudo /sbin/shutdown - h now
exit 0 its because you do not have an else statement. execution continues to the shutdown portion after your 15 seconds sleepHow would I write the else statement? I am pulling a brain fart here because I just want it to wait 45 seconds and then if firefox is open then check back in 15 seconds and if it is not there then shut off the device.....

Did I forget to mention I am also fairly new to linux..

Thanks,Code: [Select]#!/bin/sh --
sleep 45s
if [ ` pidof firefox-bin` ]; then
sleep 15s
else
sudo /sbin/shutdown - h now
exit 0
fi

please read Now the only problem is that it DOESNT shut the device down when firefox closes... check with PS -ef |grep firefox after firefox closes to see if there are any more firefox processes... I assume you want to shutdown the whole computer system? Sorry for the delay, I have been BUSY with flooding in our area. I do want the entire system to shutdown and no I did not see any firefox processes.



Discussion

No Comment Found