I am running FreeBSD 11.1-RELEASE-p10 and trying to schedule a cronjob to run a daily script which will use duplicity(1) to backup my ~/Documents directory to an Azure blob. The script (~/.duplicity/.backup1.sh) reads as follows:
The script permissions are:
and I can run it fine by itself via:
Note the "dot space slash" at the beginning.
The issue is that I can't get the script to run via cron(8). My crontab(5) is as follows:
At the appointed time, nothing happens but I do get the following in my /var/log/cron:
Per the handbook, when I run:
I get:
Any ideas or suggestions?
Thanks in advance!
Code:
#!/bin/bash
# the true variable values are in my real script
export AZURE_RESOURCE_GROUP="azure_resource_group"
export AZURE_STORAGE_ACCOUNT="azure_storage_account"
export AZURE_ACCOUNT_NAME="azure_account_name"
export AZURE_STORAGE_ACCESS_KEY="azure_storage_access_key"
export AZURE_ACCOUNT_KEY="azure_account_key"
export CONTAINER_NAME="azure_container_name"
export GPG_KEY="gpg_key"
export PASSPHRASE="passphrase"
HOME="/home/spython01"
/usr/local/bin/duplicity \
--verbosity info \
--encrypt-sign-key=$GPG_KEY \
--full-if-older-than 7D \
--log-file $HOME/.duplicity/info.log \
$HOME/Documents \
azure://$CONTAINER_NAME
# unset key environment variables
unset AZURE_RESOURCE_GROUP
unset AZURE_STORAGE_ACCESS_KEY
unset AZURE_ACCOUNT_KEY
unset GPG_KEY
unset PASSPHRASE
The script permissions are:
-rwxr-xr-x 1 spython01 spython01 1069 Jun 9 11:59 .backup1.sh
and I can run it fine by itself via:
$ . /home/spython01/.duplicity/.backup.sh
Note the "dot space slash" at the beginning.
The issue is that I can't get the script to run via cron(8). My crontab(5) is as follows:
Code:
$ crontab -l
SHELL=/bin/bash
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
# Order of crontab fields
#m hour mday month wday command
10 13 * * * . /home/spython01/.duplicity/.backup1.sh
At the appointed time, nothing happens but I do get the following in my /var/log/cron:
Jun 9 13:10:00 t430 /usr/sbin/cron[9838]: (spython01) CMD (. /home/spython01/.duplicity/.backup1.sh)
Per the handbook, when I run:
$ env -i SHELL=/bin/bash PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin LOGNAME=spython01 . /home/spython01/.duplicity/.backup1.sh
I get:
env: .: Permission denied
Any ideas or suggestions?
Thanks in advance!