Charles,
I'm taking from this discussion that I will need to parse the output of sipp
in my script, and use the pid I glean from this to apply to the 'wait'
command.
I wish it weren't such a convoluted task as what I'm trying to do seems
exactly what this tool could help with (i.e. test if a service is running or
not, and take action based on the outcome)!
Thank you for the help,
-Lukas
_____
From: Charles P Wright [mailto:[EMAIL PROTECTED]
Sent: 29 January 2007 18:44
To: Lukas Oberhuber
Cc: 'Pandurangan R S'; [email protected];
[EMAIL PROTECTED]
Subject: Re: [Sipp-users] Cron using Sipp
Lukas,
Before SIPp detaches itself from the terminal it produces output that
includes the PID. The SIPp process that was started from the command line
with -bg will exit zero (or unknown, I don't remember which), but another
process will carry on creating traffic in the background. You can get
output from that process using -trace_screen or other tracing options.
Charles
[EMAIL PROTECTED] wrote on 01/29/2007 01:29:07 PM:
> I'm still hopelessly lost. The documentation claims if I run sipp in
> -bg mode, 'the PID is provided'.
>
> Clearly not as the return of the command, and not in the $! variable
> either. It seems like I will have to parse the output, but then how
> do I do that if I don't have access to the output?
>
> Wait will wait for sipp to finish but if I don't give it a pid, then
> it always exits 0.
>
> Am I using this tool for the wrong thing?
>
> Here's my script:
>
> #!/bin/sh
> /usr/bin/sipp -m 1 -bg -sn uac 127.0.0.1
> wait $! # fails because the previous command was not backgrounded
> using &. If not done using -bg, then sipp doesn't run at all in cron
> scripts or backgrounded scripts
> if test $? -ne 0
> then
> echo `date` Sipp Test failed >>/var/log/asterisk/sip_test.log
> /etc/init.d/asterisk restart
> else
> echo `date` Sipp Test succeeded >>/var/log/asterisk/sip_test.log
> echo success
> fi
> exit 0
>
> -Lukas
>
>
>
> From: Pandurangan R S [mailto:[EMAIL PROTECTED]
> Sent: 29 January 2007 06:20
> To: Lukas Oberhuber
> Subject: Re: [Sipp-users] Cron using Sipp
>
> If you want to capture the messages and the screen output (so that
> you can analyze later why the scenario failed)
> then you can use -trace_msg and -trace_screen
>
> -trace_msg : Displays sent and received SIP messages in
> <scenario file name>_<pid>_messages.log
>
> -trace_screen : Dump statistic screens in the
> <scenario_name>_<pid>_screens.log file when
> quitting SIPp. Useful to get a final status report
> in background mode (-bg option).
> On 1/29/07, Lukas Oberhuber <[EMAIL PROTECTED]> wrote:
> Thank you for responding.
>
> What I really want to do is restart asterisk if the sipp command
> fails. Here's the full script I'd like to run in cron:
>
> #!/bin/sh
> >/var/log/asterisk/sip_test.log
> sipp -m 1 -sn uac 127.0.0.1 >& /dev/null
> if test $? -ne 0
> then
> /etc/init.d/asterisk restart
> echo Test failed >>/var/log/asterisk/sip_test.log
> else
> echo Test succeeded >>/var/log/asterisk/sip_test.log
> fi
> exit 0
>
> Do you think the -bg option will work in this case? I don't think it
> would because I'm depending on the output. Currently the script
> always does the Test Failed action.
>
> -Lukas
>
> Lukas Oberhuber
>
> From: Pandurangan R S [mailto:[EMAIL PROTECTED]
> Sent: 28 January 2007 19:16
> To: Lukas Oberhuber
> Subject: Re: [Sipp-users] Cron using Sipp
>
> may be you should use the -bg option for sipp in ur cron job
>
> /usr/bin/sipp -m 1 -sn uac 127.0.0.1 -bg > /tmp/a_log.log
> On 1/28/07, Lukas Oberhuber <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've been trying to use sipp in a cron job. For some reason it
> doesn't work at all. The script runs fine outside of cron, but then
> in cron, nothing happens. I've narrowed down the problem to sipp by
> testing only sipp.
>
> Here is the command I run in cron:
>
> /usr/bin/sipp -m 1 -sn uac 127.0.0.1 > /tmp/a_log.log
>
> So:
>
> * * * * * /usr/bin/sipp -m 1 -sn uac 127.0.0.1 > /tmp/a_log.log
>
> This outputs nothing to a_log.log even though the command is run. It
> is as if sipp was never called.
>
> /var/log/syslog:
> Jan 27 20:00:01 beta /USR/SBIN/CRON[32764]: (root) CMD (echo
> `/usr/bin/sipp -m 1 -sn uac 127.0.0.1` >/tmp/a_log.log)
>
> Additionally, I have noticed that if I put sipp in the background:
>
> /usr/bin/sipp -m 1 -sn uac 127.0.0.1 > /tmp/a_log.log &
>
> Sipp stops completely.
>
> Basically I'm stymied. Do I have to write a script that execs/forks
> sipp with -bg and then joins it when it finishes? Is that the only way? L
>
> I am running on Ubuntu and the version it installs is:
> Sipp v1.1pre-with-TLS, built Dec 29 2005, 16:43:17.
>
> Thanks,
>
> -Lukas
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> Sipp-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sipp-users
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sipp-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sipp-users
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users