Rework LuCI build system
[project/luci.git] / applications / luci-app-pbx / root / etc / pbx-asterisk / delayedcallback
1 #!/bin/sh
2
3 # Check if there are more than one instance of this command
4 # with the same command line running at the same time for some
5 # reason, then quit. We are checking for the same
6 # commandline in order to permit two different callback
7 # attempts simultaneously.
8
9 if ! grep -q "$@" /dev/shm/delayedcallback.[0-9]* 2>/dev/null
10 then
11   echo "$@" > /dev/shm/delayedcallback.$$
12   sleep 25
13   asterisk -r -x "$1 $2 \"$3\" $4 $5 $6"
14   rm /dev/shm/delayedcallback.$$
15 #  echo "`date` $@": >> /dev/shm/delayedcallback.log
16 #else
17 #  echo "`date` ERROR: There appears to be a callback attempt in progress to: $@" >> /dev/shm/delayedcallback.err
18 fi