0

I have a cron job setup that is suppose to be running the wal-e backup-push command. The command works fine if manually ran through the command line. As the postgres user of course. So I setup a cron job to run this under the postgres user. It runs but does not do anything. The cron log says the job was completed.

Am I missing something obvious here? Any suggestions or help would be great.

0 2 * * * source ~/.bashrc && envdir /etc/wal-e.d/env wal-e backup-push /db01/pg

I've also tried.

0 2 * * * bash -l -c 'source ~/.bashrc && envdir /etc/wal-e.d/env wal-e backup-push /db01/pg'

Cron Log Messages:

CROND[31371]: (postgres) CMD (bash -l -c 'source ~/.bashrc && envdir /etc/wal-e.d/env wal-e backup-push /db01/pg')

CROND[31655]: (postgres) CMD (/usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /db01/pg)

  • Please post a sample of the log, sometimes this helps determine how the command ran - e.g. I ran in to a similar issue the other day and perusing the logs showed that the command that was run was shorter than the one in cron and I had to escape a special character to fix it (ducea.com/2008/11/12/using-the-character-in-crontab-entries - not my blog, just for reference). You don't seem to have a % symbol in your command, however it'd still be useful to see. – Alex Berry Dec 9 '14 at 16:47
  • Here is the output from the log. CROND[31371]: (postgres) CMD (bash -l -c 'source ~/.bashrc && envdir /etc/wal-e.d/env wal-e backup-push /db01/pg') – wallerjake Dec 9 '14 at 20:41
  • Also tried this with no luck. CROND[31655]: (postgres) CMD (/usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /db01/pg) – wallerjake Dec 9 '14 at 20:55
0

This command is the final solution. It turned out that I was using the incorrect envdir path. I found the correct path by using which envdir when logged into the shell.

source ~/.bashrc; /usr/local/bin/envdir /etc/wal-e.d/env wal-e backup-push /db01/pg

-1

Not working. Tried following option in cron.

/usr/local/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /pg/data

bash -c "/usr/local/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /pg/data"

source ~/.bashrc && envdir; /usr/local/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /pg/data

  • This isn't an answer to the original question. If you've got a similar but different problem then best to ask a new question with more details. – Paul Haldane Apr 24 '17 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.