I have this Perl script that runs at system startup time to mount some
volumes via Samba off a Windows XP box. If it fails to mount the volumes
(presumably because the XP box is down), it requeues itself for
execution 60 seconds later via an at command. The relevant part of the
script is this:
for my $mount_point (keys %need_mounting)
{
# retry ones which haven't been done
my($settings, $status);
$settings = $need_mounting{$mount_point};
$status = system("/bin/mount", "-t", "smbfs", "-o",
$settings->{"options"}, $settings->{"share"}, $mount_point);
$status >>= 8;
if ($status == 0)
{
print $mount_point . " successfully mounted.\n";
delete $need_mounting{$mount_point};
} # if
} # for
if (scalar(keys %need_mounting) != 0)
{
# not all done, wait a while and try again
system "echo \"$0\" | at now +1 minutes";
} # if
This script always works fine if I invoke it manually. However, it never
seems to work at startup time. Instead, I get e-mail messages like this
from the at job:
SMB connection failed
5588: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed
5590: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed
5592: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed
5594: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
warning: commands will be executed using (in order) a) $SHELL b) login
shell c)
/bin/sh
job 9911 at 2005-01-18 12:45
Now, can anyone tell me, what's different about the at-job execution
environment that causes the script to fail?
Thanks in advance for any suggestions.
|