0

I'm not sure how to title that more succinctly and still have it be meaningful.

(Note that this works fine when run mid-day, via cron or manually, so I "know" the script itself is sound.)

I have a cron job (ubuntu 13.04.)
It runs as my user (not root.)

The job itself runs at 6:00 in the morning. It's the first 'business level' job that runs all day.

1 6 * * 1-5 /home/me/bin/run_perl_job

run_perl_job is just:

#!/bin/bash
cd /home/me/bin
./script.pl

The script copies a file to "/mnt/shared_drive/outputfile.xls"

The mount point is defined in fstab as:

//fileserver/share /mnt/shared_drive cifs user=domain/me%password,iocharset=utf8,gid=1000,uid=1000,sec=ntlm,file_mode=0777,dir_mode=0777 0 0

Now. Given that:

  • When I run the script in a normal shell, it works fine.
  • When I look at the mount point first thing in the morning (via a normal terminal) it shows up (and is writeable) without event.
  • When I copy the crontab line and set it to run in a couple minutes, to see the symptom, it works fine (creates the file quite happily.)

The ONLY time this fails is if it's running in its normal time slot (6:01). The rest of the script functions ( the file itself has to be pulled down via sftp, etc.) So I know it's not dying.

It's driving me batty because the test cycle is 24 hours.

I just added the following couple lines to the beginning of the 'run_perl_job' script, hoping it exposes something tomorrow:

cd /mnt/shared_drive
ls -lrt >>home/me/bin/process.log

But I'm stumped. "It's almost as though" the mount point had gotten stale overnight and is waiting for some kind of access attempt before remounting. I'd run "mount -a" at the top of the 'run_perl_job' script if I could reasonably do it. But given that it's got to be sudo'ed, that doesn't seem reasonable to me.

Thoughts? I'm running out of ideas and this test cycle is awful.

1 Answers1

0

how about putting a

   umount -f -v /mnt/shared_drive
   mount -v -a

into a root cron job just before your script runs. That way you don't need to sudo in your script and have the password in plain sight. -v might give you a hint on what is happening to make it stale

KeepCalmAndCarryOn
  • 8,817
  • 2
  • 32
  • 47
  • At this point I'll try most anything. I did ALmost that (just a 'mount -a') to no avail. In fact even the ls redirected in to the file worked, which stumps me entirely. – Frobnosticus Jul 17 '13 at 13:14