I have the following script that saves a db backup to s3:
# next, backup the mysql `premiered` database to the backups folder
echo successfully backed up mysql databasee
mysqldump --single-transaction -u root test | gzip > $BACKUPFOLDER/$CONNECT
# finally, save the backups to s3 via s3fs
s3fs test-backups ./s3fs
cp $BACKUPFOLDER/$CONNECT ./s3fs/$CONNECT
echo succeessfully saved sql file to s3
When I run this as a shell command, $ ./backup.sh
, it correctly saves the file to S3. However, when I run this command via cron, it literally saves the file to the local ./s3fs
folder and does not save it to S3. Why does this occur and what do I need to do to fix this?