Skip to content

Backup doesn't work under cron #133

@kmfreas

Description

@kmfreas

Hi there,

Love the script, it seems to work great when I run it normally. I'm having an issue with it not running in a cron job. I've checked many other related issues and didn't see anything directly related to my issue. I have to admit that I'm not the most familiar with cron jobs, so it could be something I just haven't done yet.

This is what I'm running from crontab -e, as user ubuntu (running it every minute temporarily until I get it working):
* * * * * /home/ubuntu/ec2-automate-backup.sh -r us-east-1 -s tag -t Backup,Values=true -k 7 -p -n -c /home/ubuntu/cron-primer.sh >> /home/ubuntu/backup.log

This is my cron-primer.sh. I added /usr/local/bin to the path as per this issue
#!/bin/bash -
# export PATH=/bin is required for cut, date, grep
# export PATH=/usr/bin is required for AWS Command Line Interface tools
export PATH=/bin:/usr/bin:/usr/local/bin

# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY needed for AWS CLI tools
export AWS_ACCESS_KEY_ID=xxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxx

# AWS_CONFIG_FILE required for AWS Command Line Interface tools (f.e. ".aws")
export AWS_CONFIG_FILE=/home/ubuntu/.aws/config

Thanks for looking!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions