Gentoo Archives: gentoo-user

From: Helmut Jarausch <jarausch@××××××××××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Script to tar.tgz /etc, works run manually, broken when run from cron
Date: Mon, 31 Mar 2014 11:27:08
Message-Id: 1396265223.30539.0@numa-i.igpm.rwth-aachen.de
In Reply to: [gentoo-user] Script to tar.tgz /etc, works run manually, broken when run from cron by Tanstaafl
1 On 03/31/2014 01:01:48 PM, Tanstaafl wrote:
2 > Hi all,
3 >
4 > Ok, this is really irritating me...
5 >
6 > I have a script that simply performs some backups. The commands are
7 > like this:
8 >
9 > # perform tar.tgz backup of /etc
10 > tar -czpvf $BKUP_DIR_etc/$BKUP_DateTime-dev-ecat-etc.tgz /etc
11 >
12 > When I run this script manually, it does what it is supposed to, and
13 > the resulting file is about 500K.
14 >
15 > When it runs from cron (roots crontab), it results in a 20 byte
16 > (empty) file.
17 >
18 > So what am I missing/doing wrong?
19 >
20
21 This is what I do when debugging such things
22
23 put
24
25 echo $BKUP_DIR_etc/$BKUP_DateTime-dev-ecat-etc.tgz >/tmp/cron.LOG
26 into an executable script and run it with
27 at now+1minute
28 and check /tmp/cron.LOG
29
30 perhaps one of $BKUP_DIR_etc or $BKUP_DateTime-dev-ecat-etc
31 isn't know in that environment
32
33 Helmut