From owner-freebsd-isp Wed Jun 9 10:44: 4 1999 Delivered-To: freebsd-isp@freebsd.org Received: from loki.intrepid.net (intrepid.net [204.71.127.3]) by hub.freebsd.org (Postfix) with ESMTP id 58CF214EA6 for ; Wed, 9 Jun 1999 10:44:01 -0700 (PDT) (envelope-from mark@loki.intrepid.net) Received: (from mark@localhost) by loki.intrepid.net (8.8.5/8.8.5) id NAA06939 for freebsd-isp@FreeBSD.ORG; Wed, 9 Jun 1999 13:43:58 -0400 Message-ID: <19990609134358.J26725@intrepid.net> Date: Wed, 9 Jun 1999 13:43:58 -0400 From: Mark Conway Wirt To: freebsd-isp@FreeBSD.ORG Subject: Forking Problem w/ Perl, FBSD 3.1 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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