Please check the below CGI Script which executs a simple list command on the remote box and prints the output on the HTML page. This displays the webpage only after the command execution is done. What I need to achieve is to display the page immediately after the command execution and then show the output of the command as and when it comes.
Please let me know if you have any ideas on how to proceed. I posted here with lot of expectations :)Thanksuse strict; use CGI qw(:all); # import shortcuts use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NB use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # For Debugging use Net::SSH::Perl; print header; my ( $TITLE, # page title & header $DeploySvr, $KIT, $ssh, $UNM, $Pass, $stdout, $stderr, $exit, $cmd, ); $TITLE = "UNIX Deployment Tool"; $DeploySvr=param('DrpServer'); $KIT=param('TxtKit'); $UNM=param('username'); $Pass=param('password'); $ssh = Net::SSH::Perl->new('113.128.160.214'); $ssh->login($UNM, $Pass); $cmd="ls -l"; my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print start_html($TITLE); print h1($TITLE); print hr, start_form; print $stdout; print $stderr; print endform, hr; print h2("Prior Messages"); print end_html;
In reply to Asynchronous Processing a command execution by Alfaromeo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |