Re: GPG in crontab causes blank messages
- From: Tom Stiller <tomstiller@xxxxxxxxxxx>
- Date: Thu, 23 Aug 2007 15:20:11 -0400
In article
<usenet.kadin-F01ECA.14471823082007@xxxxxxxxxxxxxxxxxxxxxxxx>,
Kadin2048 <usenet.kadin@xxxxxxxx> wrote:
I'm having a strange issue involving my crontab that's totally got me
stumped. When I run my crontab command manually in terminal, it works
fine; but when it actually runs on its own, it seems to fail.
Background: I use a couple of shell scripts to back up my Macs
~/Documents folders to a remote machine in the middle of the night.
Basically, I have it set up so that the script runs, and its output is
emailed to me via the CLI "mail" program. (I have postfix set up with a
smarthost on each machine so that this works.)
But since the output of the script contains a big list of files, I
decided to encrypt the script's output before sending it via plaintext
email. This seemed pretty simple -- I'll just pipe the output from the
script through GPG, and then pipe it into the mail program as usual to
email it.
Example crontab entry: (one long line)
30 1 * * * sh ~/bin/backup.sh 2>&1 | gpg -e -a -r myemail@xxxxxxx | mail
-s "[Auto] Daily Backup Report" myemail@xxxxxxx
When I take the command and run it manually, by just copying/pasting and
executing it in the Terminal, it works perfectly. What I get is the
output of the backup script, emailed to me as an ASCII-armored,
GPG-encrypted message. Exactly what I want.
However, when the thing runs at night, all I get in the morning is a
blank email message. If I remove the GPG portion of the command, it
works (I get a plaintext message with the script output).
I'm a little mystified as to why a command would work when typed
directly into Terminal, but would misbehave when in a crontab.
Has anyone ever run into anything like this before? Any suggestions or
obvious flaws in what I'm trying to do?
It looks like you don't have the environment for the crontab execution
set to include the path to gpg. Try either explicitly specifying the
path to gpg or including a PATH statement that specifys the path.
--
Tom Stiller
PGP fingerprint = 5108 DDB2 9761 EDE5 E7E3 7BDA 71ED 6496 99C0 C7CF
.
- Follow-Ups:
- Re: GPG in crontab causes blank messages
- From: Kadin2048
- Re: GPG in crontab causes blank messages
- Prev by Date: Re: Temperature control for MacBook?
- Next by Date: Re: Temperature control for MacBook?
- Previous by thread: Temperature control for MacBook?
- Next by thread: Re: GPG in crontab causes blank messages
- Index(es):
Relevant Pages
|