Date: Wed, 09 Jun 1999 13:17:33 -0500 From: Joe Nall <joe@nall.com> To: Mark Conway Wirt <mark@intrepid.net> Cc: freebsd-isp@FreeBSD.ORG Subject: Re: Forking Problem w/ Perl, FBSD 3.1 Message-ID: <375EAFBD.62EC48F@nall.com> References: <19990609134358.J26725@intrepid.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Mark Conway Wirt wrote: > > I have a server running FBSD 3.1, and I have a cron job that -- in > addition to some other things -- creates directories if necessary and > chown's them. A snippet of the code: > > if (!(-d $dir)) { > print "Creating $dir\n"; > mkdir "$dir",0777; > system("/var/qmail/bin/maildirmake $dir/Maildir"); > system("chown -R vpopmail.vchkpw $dir"); > > } > > In other words, if the directory does not exist, it forks a system > call to create it (and some sub-directories) and then forks a system > call to chown it. > > The problem is that sometimes the chmod works, and sometimes it > doesn't. As near as I can figure it, the system fork is sometimes > returning before the directories are created, and when that happens > the chmod fails because it's attempting to access files that have not > been "written to disk" yet. I've added a sync: > > system("(/var/qmail/bin/maildirmake $dir/Maildir; sync)"); > > and that seems to help, but the following chmod still fails some time. There is no chmod in your code snippet. Do you mean the chown? Are you sure the script doesn't launch anything asynchronous? Check the status returns on all of the calls. Is the filesystem NFS mounted? I have seen behavior like this on broken (non FreeBSD) NFS implementations, but not lately. -- Joe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?375EAFBD.62EC48F>