[PLUG] Temp directory weirdness
Michael Rasmussen
michael at jamhome.us
Wed Oct 19 00:23:20 UTC 2011
On Tue, Oct 18, 2011 at 04:39:42PM -0700, Russell Johnson wrote:
>
> On Oct 18, 2011, at 3:25 PM, Michael Rasmussen wrote:
>
> > It doesn't die?
> >
> > Are you sure it runs? ie, does the root crontab have the proper path elements for this to function?
> >
> > Check the return code from print. As in:
> >
> > sub writetemp {
> > open (NEWFILE, ">/tmp/$0.count") or die $!;
> > my $ok = print NEWFILE "$product{name}.value $product{value} $date";
> > if ( ! $ok ) {
> > print STDERR "error on print to file: $!\n";
> > }
> > close (NEWFILE);
> > }
> >
> > or print NEWFILE "$product{name}.value $product{value} $date" or warn "$!";
>
> As a test, I set it up under the ubuntu user. When run from the command line, the script runs and properly creates the expected output file in the /tmp directory.
>
> When I set up the crontab to run the script as ubuntu, I get an email saying:
>
> "No such file or directory at /home/ubuntu/bin/test line 99."
Which implies:
sub writetemp {
print STDERR "sanity check of \$0 $0 value\n";
open (NEWFILE, ">/tmp/$0.count") or die $!;
my $ok = print NEWFILE "$product{name}.value $product{value} $date";
if ( ! $ok ) {
print STDERR "error on print to file: $!\n";
}
close (NEWFILE);
}
Going to AT tonight? Have remote access to the box in question?
--
Michael Rasmussen, Portland Oregon
Other Adventures: http://www.jamhome.us/ or http://westy.saunter.us/
Fortune Cookie Fortune du jour:
There are those who listen and those who wait to talk.
More information about the PLUG
mailing list