Gentoo Archives: gentoo-user

From: Daniel Frey <djqfrey@×××××.com>
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 14:43:47
Message-Id: 53397F15.1030502@gmail.com
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 04:01 AM, 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 like
7 > 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 the
13 > resulting file is about 500K.
14 >
15 > When it runs from cron (roots crontab), it results in a 20 byte (empty)
16 > file.
17 >
18 > So what am I missing/doing wrong?
19 >
20
21 You need to use the full path to commands in your script or set an
22 environment variable. In my case using full paths to executables was enough.
23
24 i.e.
25
26 # perform tar.tgz backup of /etc
27 /bin/tar -czpvf $BKUP_DIR_etc/$BKUP_DateTime-dev-ecat-etc.tgz /etc
28
29 Dan

Replies

Subject Author
Re: [gentoo-user] Script to tar.tgz /etc, works run manually, broken when run from cron Tanstaafl <tanstaafl@×××××××××××.org>