1 |
Just to rule out the obvious here, does the user you're running the |
2 |
cronjob as have permissions to read /dev/nst0 ? I only ask because |
3 |
alsmot everything in /dev is owned by root. Could you post the cron line |
4 |
you're using as well? I realize you probably have to run the job as root |
5 |
to perform the load and rewind. |
6 |
btw, tar -F implies -M, it doesn't need to be stated twice. (ps, i am |
7 |
fairly new to linux) =) |
8 |
|
9 |
Rob |
10 |
|
11 |
Frank Nørvig wrote: |
12 |
|
13 |
> Hi there, |
14 |
> |
15 |
> I'm making a tape backup-script that looks like this: |
16 |
> |
17 |
> #!/usr/bin/perl -w |
18 |
> WriteLog("Loading tape..."); |
19 |
> $exec = `mtx -f /dev/sg0 first 2>&1`; |
20 |
> if ($exec) { WriteLog($exec); } |
21 |
> |
22 |
> WriteLog("Rewinding tape..."); |
23 |
> $exec = `mt -f /dev/nst0 rewind 2>&1`; |
24 |
> if ($exec) { WriteLog($exec); } |
25 |
> |
26 |
> WriteLog("Backing up data..."); |
27 |
> $exec = `tar -c -p --exclude-from=/opt/backup/backup-exclude.txt -M |
28 |
> -F /opt/backup/changetape.pl -f /dev/nst0 /var/data 2>&1`; |
29 |
> if ($exec) { WriteLog($exec); } |
30 |
> |
31 |
> ... (rest is not important) |
32 |
> |
33 |
> When running this script from bash it works like a charm. All data |
34 |
> from /var/data is backed up onto tape and everyone is happy. |
35 |
> |
36 |
> BUT when I put the script into my cronjob for automatic start in the |
37 |
> night, it fails with following error: |
38 |
> |
39 |
> [2004-09-21 05:43:58] Loading tape... |
40 |
> [2004-09-21 05:43:58] Rewinding tape... |
41 |
> [2004-09-21 05:44:58] Backing up data... |
42 |
> [2004-09-21 05:46:59] tar: /dev/nst0: Cannot open: Input/output error |
43 |
> tar: Error is not recoverable: exiting now |
44 |
> |
45 |
> Why is this happening? And why is it only happening when run from the |
46 |
> cronjob? Nothing else is run and no other program is using the |
47 |
> tape-robot. The two tape-commands (mt and mtx) runs smoothly and loads |
48 |
> + rewinds the tape but the tar command fails everytime and has for |
49 |
> over a month now. Every morning I have to run the script manually from |
50 |
> bash and it runs perfectly then. |
51 |
> |
52 |
> I'm not new to Linux (or Gentoo) and has been installing and |
53 |
> maintaining servers for more than 4 years now but this problem is a |
54 |
> killer :( |
55 |
> |
56 |
> Frank Nørvig |
57 |
> |