I have a Red Hat Kickstart process which reports its progress at key points via a POST request to a status server.
This is fine during %pre and %post, but when the actual build is taking place between them, it's an informational black hole.
I've written a simple shell snippet that reports on the number of packages installed to give a rough idea of progress. I've placed the following in %pre:
%pre
## various other stuff here, all works fine ##
cat > /tmp/rpm_watcher.sh << EOF_RPM
PREV=-1
while true
do
COUNT="\$(rpm -qa | wc -l)"
if [ \${COUNT} -ne \${PREV} ] ; then
/bin/wget --post-data " ${Hostname} : Package count \${COUNT}" ${builddest}/log
PREV=\${COUNT}
fi
sleep 15
done
EOF_RPM
/bin/sh /tmp/rpm_watcher.sh &
disown -a
%end
However, when I launch this as a background task from %pre as above, it hangs waiting for the script to end -- %pre never completes (if I kill the spawned script %pre completes and the build proper starts).
I can't use nohup as it isn't available in the pre-installation environment, the same goes for using at now and screen.
I've attempted to use disown -a, which is available; this seems to successfully disown the process (such that it's owned by PID 1) but still it hangs waiting for the script to finish.
Can anyone offer me an alternative?