I run these three commands everyday:
cd /Users/xxx/code
heroku pgbackups:capture --expire
curl -o latest.dump `heroku pgbackups:url`
So I thought I’d try to move it into a cron job so I created a file called /Users/xxx/code/backup_script that has the following:
cd /Users/xxx/code
heroku pgbackups:capture --expire
curl -o latest.dump `heroku pgbackups:url`
However, when I run ./backup_script it gives this error:
./backup_script
./backup_script: line 2: heroku: command not found
./backup_script: line 3: heroku: command not found
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
I’m a unix newbie – can someone help me figure out how to fix the script above?
The environment variables for a cronjob are significantly reduced from your login; you’ll want to set $PATH for your crontab.
For instance:
You may want to run
which herokuto figure out what path you need to add.