in reply to Re^13: show a message only during the sleep time
in thread show a message only during the sleep time

thanks,
I changed to:
my $stop = `/usr/local/bin/sudo /usr/local/www/cgi-bin/ntop/ntop.sh st +op` or die "cannot stop ntop: $!";

Replies are listed 'Best First'.
Re^15: show a message only during the sleep time
by merlyn (Sage) on Jul 25, 2005 at 22:13 UTC
      this script should stop the ntop and start it again after 8 seconds.

      I did some tests and ntop will be stopped with:
      my $stop = `/usr/local/bin/sudo /usr/local/www/cgi-bin/ntop/ntop.sh st +op` or die "cannot stop ntop: $!";
      and started again with:
      <br> my $start = `/usr/local/bin/sudo /usr/local/www/cgi-bin/ntop/ntop.sh s +tart` or die "cannot start ntop: $!";
      I cannot see errors on the ntop output.

      I have only one problem if the ntop is already running,
      an I start the script, I don't get any errors,
      but if it was stopped before,
      then I get an error:
      Software error: cannot stop ntop: at /usr/local/www/cgi-bin/ntop/ntop.cgi line 41.

      it needs to check first if the ntop is already running and then stop it.
      or has someone any other idea ?
        You still haven't completely specified what you want to do, and what ntop.sh is doing.
        • What does ntop.sh exit with on success or failure, for both starting and stopping?
        • What does ntop.sh say on success and failure, for both starting and stopping?
        • How do you want to wire that in to your program?
        Do you now understand system() and backquotes? Do you know what "and die" vs "or die" does?

        It seems so far you're just randomly throwing stuff in (we call that "cargo culting") without understanding. Are you understanding this yet?

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.