I am trying to run a backup script foo.sh
via cron
. The code is as follows:
#!/bin/bash
export PASSPHRASE=password123
duplicity ../learningbash file://../../../media/kingston
unset PASSPHRASE
Then I add dthe following line in "crontab -e":
58 07 * * * /home/ashish/learningbash/foo.sh
It runs perfectly when I run it from the terminal using ./foo.sh
. But it does not run from the cron
. Also, if I edit "foo.sh" to the following code, the first line executes perfectly from the cron
. But the backup script doesn't run.
#!/bin/bash
touch hello.txt
export PASSPHRASE=bacteria99
duplicity ../learningbash file://../../../media/kingston
unset PASSPHRASE