|
Home > Archive > Red Hat Kernel > February 2006 > CD (write) works perfectly when root but not when cron
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
CD (write) works perfectly when root but not when cron
|
|
| linuxlover992000@yahoo.com 2006-02-06, 5:55 pm |
| I have this weird problem which I do not seem to be able to
troubleshoot (in my Fedora Core 4 system):
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
| |
| Scott Lurndal 2006-02-06, 8:48 pm |
| linuxlover992000@yahoo.com writes:
>I have this weird problem which I do not seem to be able to
>troubleshoot (in my Fedora Core 4 system):
>
>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
| |
| linuxlover992000@yahoo.com 2006-02-07, 8:48 pm |
| The script doesn't do much: it just archives entire home directory in a
tar file, then writes the file to the CD using cdrecord as follows:
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?
| |
| Bit Twister 2006-02-07, 8:48 pm |
| On 7 Feb 2006 17:05:38 -0800, linuxlover992000@yahoo.com wrote:
> The script doesn't do much: it just archives entire home directory in a
> tar file, then writes the file to the CD using cdrecord as follows:
>
> 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.
| |
| Scott Lurndal 2006-02-07, 8:48 pm |
| Bit Twister <BitTwister@mouse-potato.com> writes:
>On 7 Feb 2006 17:05:38 -0800, linuxlover992000@yahoo.com wrote:
>
>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
| |
| Linux Lover 2006-02-08, 9:06 pm |
| OK - I solved the problem. It turns out that for some strange reason
this problem coincided with sudden increase of the data to be backed up
in such a way that it exceeded the 700MB CD limit.
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
|
|
|
|
|