[asterisk-users] [tip]semicolon trouble: System($(sleep 4;
cp 1.call out)&) not working, but System($( sleep 4 && cp 1.call
out)&) ; )
Maxim Vexler
hq4ever at gmail.com
Sat Jul 8 07:58:05 MST 2006
On 7/7/06, Robert Michel <news at robertmichel.de> wrote:
> Salve *!
>
> Semicolon inside extensions.conf marks the start of the comment,
> so no chance to use it to build a list of bash comments -
> alternative: && and || see:
> man bash | grep -A 33 Lists
>
>
> When I try to use my (GSM)mobile to initiate a callback, I found
> out that it would be good, if this callback is delayed with some
> seconds - and I don't want to put it in a external skript
> System ($(delayed-callback.sh) &)
> because this would be not so clear, IMHO.
>
> BTW, I use "$(command1; command2) &" to send the commandlist
> "command1; command2" into the background, asterisk would go on
> with the dialplan without waiting for finish both commands.
>
> BUT System($(sleep 4; cp 1.call out)&) Is not working,
> the trick to build a commandlist without ";" is:
> Sytem($( sleep 4 && cp 1.call /var/spool/asterisk/outgoing) &)
>
>
> Have a nice weekend,
> rob
>
>
>
> PS: To do not make noise with small tips like this, like
> ("hey I'm a newbee, I have found out somethink usefull..."),
> where are the best places to look first if this ideas are
> already known and documentated?
> Inside the asterisk Handbook was no tip to deal with ";"
> inside "Sytem()"......
>
> And excuse me to send my question about vserver and colored CLI
> twice - I didn't got my mails from the listserver and I thought
> I killed it - in future I will look there first.
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
exten => 100,1,System(touch /tmp/file1 \; touch /tmp/file2) works for me.
Note that && and || are logical operators, so that if the first
command fails (speaking bashisem: return non zero value) and you used
the && operator then the second command won't run. where as ';' simply
means "run them all, one after the other".
--
Cheers,
Maxim Vexler
"Free as in Freedom" - Do u GNU ?
More information about the asterisk-users
mailing list