Elliot Murdock
2009-Sep-06 09:45 UTC
[asterisk-users] running a asterisk -rx command in bash backgroun
Hello! I have a very simple bash script: #!/bin/bash asterisk -rx "sip show peers" > /var/log/devices When I run it in bash shell, everything works fine, but if I background it (by adding & or using bg), nothing appears in the /var/log/devices file. Any reason for this behavior or help would be great! Thanks, Elliot
Gordon Henderson
2009-Sep-06 11:12 UTC
[asterisk-users] running a asterisk -rx command in bash backgroun
On Sun, 6 Sep 2009, Elliot Murdock wrote:> Hello! > > I have a very simple bash script: > > #!/bin/bash > asterisk -rx "sip show peers" > /var/log/devices > > When I run it in bash shell, everything works fine, but if I > background it (by adding & or using bg), nothing appears in the > /var/log/devices file. > > Any reason for this behavior or help would be great!Even though it doesn't need it, it seems to be expecting keyboard input, so it stalls. Odd, but I'm sure there's a reason for it. Try this: rasterisk -x 'sip show peers' > /var/log/devices < /dev/null & You may now have lots of processes stuck, waiting, so best run ps ax | fgrep asterisk to check. Gordon