Hello,
I want to put in a startup script (ie., /etc/init.d script) a command that is run and pipes its lines to a while read loop. However, I want the command to nohup and background because it is supposed to be a startup script. I am not sure how to do this however. Here is the piece of code that has the command:
echo "Starting vxnotify..."
`/usr/sbin/vxnotify -w 30 -f -d -c -i -A` | while read code more; do
case $code in
waiting) checkDetach;;
detach) checkDetach;;
change) checkDetach;;
disconnected) checkDetach;;
esac
done
After I start the program (e.g., /etc/init.d/vxnotify) it does not return to the command prompt. I put an ampersand (&) after the -A, but it still did not drop to the command prompt. I can run /etc/init.d/vxnotify & and it does what I want, but I do not want to do this or expect other people to know that they need to do this with the script.