Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!mips!apple!oliveb!orc!mipos3!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: why does system() not work when from root's crontab? Message-ID: <1990Mar1.210532.5891@iwarp.intel.com> Date: 1 Mar 90 21:05:32 GMT References: <6998@pitt.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 24 In-Reply-To: al@ee.pitt.edu (Alan Martello) In article <6998@pitt.UUCP>, al@ee (Alan Martello) writes: | My perl script works fine when I run it as root interactively, | however, when it is run from crontab (as root), I can kill the | processes just fine, but the "umount", "dump" and | "mount -av" commands all fail. | | I am calling these programs via a perl system() call. I suspect you are running into a problem not with Perl, but with the shell. Specifically, umount, dump, and mount are all in /etc (or /usr/etc, depending on the time of day at Sun :-). Try something like: $ENV{'PATH'} = "/etc:/usr/etc:$ENV{'PATH'}"; in the first few lines of your Perl program. Cron's default path is more along the lines of /usr/ucb:/bin:/usr/bin. $ENV{'MOTD'}='Just another Perl hacker,';system('printenv MOTD'); -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/