Date: Wed, 9 Jun 1999 13:43:58 -0400 From: Mark Conway Wirt <mark@intrepid.net> To: freebsd-isp@FreeBSD.ORG Subject: Forking Problem w/ Perl, FBSD 3.1 Message-ID: <19990609134358.J26725@intrepid.net>
next in thread | raw e-mail | index | archive | help
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. Anyone seen anything like this before? TIA. --Mark -- 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?19990609134358.J26725>