I have a script that writes selected data into a CDRW disc (/dev/cdrom
which happens to also be /dev/hdc). That script works perfectly when I
execute it manually, logged as 'root'.
I tried to automate this into a nightly backup, by placing the script
in /etc/cron.daily, which means it will be run by the cron daemon every
night. I expected to find the CD with the data ready for me in the
morning, but instead I found the following in /var/log/messages:
========= START QUOTE ===========
hdc: command error: status=0x51 { DriveReady SeekComplete Error }
hdc: command error: error=0x54 { AbortedCommand LastFailedSense=0x05 }
ide: failed opcode was: unknown
end_request: I/O error, dev hdc, sector 0
Buffer I/O error on device hdc, logical block 0
========== END QUOTE ===========
I tried running the script again manually (logged as 'root') and it has
no problem whatsoever completing. This strange I/O error occurs only
when the script is spawned by the cron daemon.
Hmmm.... weird, isn't it?
Anyone has any explanation for this? How should I begin to troubleshoot
a problem like this (doesn't seem like a hardware problem)? Could that
be related to the new security scheme (SELinux)?
Any hint or tip would be greatly appreciated.
Thanks,
Lynn
You may wish to consider posting your script. We have no idea
what it is doing.
scott
mkisofs -J -R -o /home/backup/cdimage.raw /home/backup/stagingdir
cdrecord /home/backup/cdimage.raw
Again, I don't think anything in the script is flawed, because it works
perfectly when I am logged as 'root' and running it from the command
line. The problem only exhibits itself when run by cron.
Baffling, isn't it?
Normally, not.
Usuall problem is cron environment is not the same as command line.
Fix the PATH or fully qualify program names.
Might want to also consider specifying -dev, -speed and -sao
to the command line for cdrecord.
scott
I excluded some data temporarily (until I replace the CDRW with DVDRW)
and the cron job now works perfectly.
Thank you all for your guidance. It truly helped me look at the right
direction.
Lynn