delayedcallback 638 B

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