5

Cron job works fine when executed in terminal, but never executes on its own

view full story
linux-howto

http://serverfault.com – I'm trying to run a cronjob to backup my database every day. I have created the cronjob by logging in to root and doing crontab -e, then pasting in my command: * * * * * /bin/bash -l -c 'cd /var/lib/postgresql && sudo -u postgres pg_dump db_development -O -f "/var/lib/postgresql/backup/db-`date +\%Y-\%m-\%d\\%k:\%M:\%S`.sql"' > /var/lib/postgresql/log/cron.log 2>&1 It is terribly annoying because the command works PERFECTLY if i run it in terminal, with either the postgres user or with root. However, I get no data back at all from the cronjob task. The log file is blank (HowTos)