Gentoo Archives: gentoo-server

From: "Frank Nørvig" <frank.norvig@××××××××××××.com>
To: gentoo-server@l.g.o
Subject: [gentoo-server] backup and crontab problem
Date: Tue, 21 Sep 2004 07:50:35
Message-Id: ciolq4$160$1@sea.gmane.org
1 Hi there,
2
3 I'm making a tape backup-script that looks like this:
4
5 #!/usr/bin/perl -w
6 WriteLog("Loading tape...");
7 $exec = `mtx -f /dev/sg0 first 2>&1`;
8 if ($exec) { WriteLog($exec); }
9
10 WriteLog("Rewinding tape...");
11 $exec = `mt -f /dev/nst0 rewind 2>&1`;
12 if ($exec) { WriteLog($exec); }
13
14 WriteLog("Backing up data...");
15 $exec = `tar -c -p --exclude-from=/opt/backup/backup-exclude.txt -M
16 -F /opt/backup/changetape.pl -f /dev/nst0 /var/data 2>&1`;
17 if ($exec) { WriteLog($exec); }
18
19 ... (rest is not important)
20
21 When running this script from bash it works like a charm. All data from
22 /var/data is backed up onto tape and everyone is happy.
23
24 BUT when I put the script into my cronjob for automatic start in the
25 night, it fails with following error:
26
27 [2004-09-21 05:43:58] Loading tape...
28 [2004-09-21 05:43:58] Rewinding tape...
29 [2004-09-21 05:44:58] Backing up data...
30 [2004-09-21 05:46:59] tar: /dev/nst0: Cannot open: Input/output error
31 tar: Error is not recoverable: exiting now
32
33 Why is this happening? And why is it only happening when run from the
34 cronjob? Nothing else is run and no other program is using the
35 tape-robot. The two tape-commands (mt and mtx) runs smoothly and loads +
36 rewinds the tape but the tar command fails everytime and has for over
37 a month now. Every morning I have to run the script manually from bash
38 and it runs perfectly then.
39
40 I'm not new to Linux (or Gentoo) and has been installing and maintaining
41 servers for more than 4 years now but this problem is a killer :(
42
43 Frank Nørvig

Replies

Subject Author
Re: [gentoo-server] backup and crontab problem Rob Baxter <burn@××××××.ca>
Re: [gentoo-server] backup and crontab problem Paul Court <emails@××××××××××××.uk>
Re: [gentoo-server] backup and crontab problem Martin Hajduch <martin.hajduch@×××××××××××.com>
Re: [gentoo-server] backup and crontab problem Christian Parpart <cparpart@×××××××××.net>