I'm creating a bash script of which will run on a cron, it's purpose is to backup a directory to Amazon S3 using the
I get the following error when I run the script:
/usr/bin/env: python: Not a directory
When I comment out the
s3cmd command the Python error disappears. When I run this command in the terminal it operates as usual.
For those wondering, here's my entire bash script:
#!/bin/bash # clutching at straws here # export PATH=/usr/bin/python:$PATH # get the start time START_TIME=$SECONDS # set the log file output NOW=$(date +"%m-%d-%Y") FILE="domain_s3_$NOW.log" PATH="/var/www/domain/log.domain.co/$FILE" URL="http://log.domain.co/$FILE" # fire the s3cmd sync command /usr/local/bin/s3cmd/s3cmd sync --exclude-from /root/.s3cmd-exclude /var/www/ s3://domain-backup-latest/ > $PATH ELAPSED_TIME=$(($SECONDS - $START_TIME)) # output diagnostic information echo "Backup information:" echo "- Duration: $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec" echo "- Log: $URL"
I noticed in this related question that the Python script has a different declaration at the top of the file, I guess I need something like this but I'm only really familiar with bash scripting at this stage.