• Home
  • Shell
    • Emacs
    • Perl
    • screen
    • sed
  • Ubuntu
    • VNC
  • Web Development
    • Javascript
    • Joomla
    • MySQL
    • osTicket
  • Windows
    • Gimp

Web Dev> Report on server script status using popen

Mar24
2011
Written by Scott Rowley

In your PHP page add something like the following:

Apostille services. Texas apostille. Birth certificate apostille. http://globalapostille.us/

$variable = popen("path/to/script.sh", 'r');
while (!feof($variable)) {
echo fgets($variable);
flush();
ob_flush();
}
pclose($variable);

Then in your script you can echo the output like normal — though I recommend modifying it to spit out HTML like so:

while [ 1 ]
do
read CURRENT_ACCOUNT || break
echo "Working with account $CURRENT_ACCOUNT…<br />";
done < list_of_accounts.txt

Then when you run the php page your webpage will be updated each time with the output of your script.sh until it is complete, then it will resume with the rest of your php code.

Posted in BASH, Web Development
« Javascript> Check for specific email address
» BASH> sudo bash

Corrections? Questions? Comments?

Find an error?
Everything work out great for you?
Have some feedback?
Like to see something added to the article?

PLEASE leave us a comment after the article and let us know how we are doing, or if something needs corrected, improved or clarified.

Thank you!
- The Management

Advertisement

Sudo Bash
By Geeks - For Geeks

Back to Top