Bash script forking
Hello,
I have a BASH script which run as daemon, and now I want to fork a
process which is in a function but it does not more work. (I have
done this for 2 years under Woody but in the meentime forgotten how)
----8<--------------------------
!/bin/bash
fnc_fork()
{
FORK=$1
LOG=$2/.program/log/$(date +%Y%m).log
if [ ! -d $2/.program/log ] ; then
mkdir -p $2/.program/log
fi
echo /var/run/fork.${FORK}.pid
for TEST in $(seq 10) ; do
echo "Fork: ${FORK} : Test ${TEST} >${LOG}
sleep 2
done
rm -f /var/run/fork.${FORK}.pid
}
F=1
(cat /etc/passwd) |
while read LINE ; do
if [ $(echo "${LINE}" |cut -d: -f3) -gt 999 ] ; then
U=$(echo "${LINE}" |cut -d: -f1)
fnc_fork ${F} ${U} &
disown
F=$((F+1))
fi
done
----8<--------------------------
...but failed! - This does not work. Grmpf!
Any suggestions?
Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Reply to: