I really can't see what's wrong here. I have a Digital Ocean droplet that runs a bash script every 10 mins to get some records from my DB of a Heroku slug. This is my script:
# /bin/sh
echo "Starting pull from postgres ..."
heroku pg:psql dbname --app app --command "COPY (select wallet from wallets where tokens_sent > 0) TO STDOUT WITH CSV" > wallets.csv
It gets all wallets and save them in the wallets.csv
file. If I run this script in the terminal with sh get_tokens.sh
, everything works fine! For some unknown reason, when I put this script in my crontab, it doesn't pull the data from Heroku.
I'm a root user and the root user is running the script. Below are the file permissions:
4 -rwxr-xr-x 1 root root 782 Feb 3 18:18 get_tokens.sh
16 -rw-r--r-- 1 root root 12318 Feb 3 18:21 wallets.csv
Here is my crontab record:
10 * * * * bash ~/get_tokens.sh >> logs.txt
I added the logs.txt to see if potentially some error would pop up but nothing seems wrong.
Any ideas? Thanks in advance