Delayed command?

Hallo!

Yet more cake icing.

I’m trying to run two commands from dialplan. One instantly and one in a minute’s time. However, both are executing at once. Anybody know why that might be?

If this isn’t easily doable that’s totally fine!

[domyothercoltcommand]
exten => s,1,TrySystem(. /home/asterisk/c1.sh > /dev/null 2>&1 &)
exten => s,2,TrySystem(. /home/asterisk/c2.sh | at now + 1 minute > /dev/null 2>&1 &)
exten => s,n,Return

Thanks!!

I’d drop them both into a shell script that executes under control of the shell instead of trying to do them from the TrySystem() command.

at is a tricky little bugger, you will be using /bin/sh whatever that is on your machine so paths might be a problem , also the interpreted ‘date’ string might need to be quoted, usually it is easier to use at’s -f (file to run) option

You are running a command and piping the output of that command into at, which will then be run in 1 minutes time.

I’m pretty sure that’s not what you want to do.

Add at now + 1 minute /home/asterisk/c2.sh to c1.sh (and that’s assuming that’s the correct syntax, which I’m not sure it is)

This should work if the file has the executable flag set and is owned by asterisk

at “now + 1 minute” -f /home/asterisk/c2.sh

What are you trying to accomplish?

Maybe you can use a Wait(60) in your dialplan

Not a good idea, it will be ‘blocking’, trysystem is not (which is why it is there)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.