rafinkanisa / ngm-reportDesk

The workdesk for ReportHub
0 stars 1 forks source link

Failed to upload to S3 #159

Open rafinkanisa opened 3 years ago

rafinkanisa commented 3 years ago

There is an issue with the cron job when uploading the backups to S3 The issue is related to the credentials.

Kindly fix the issue

rafinkanisa commented 3 years ago

As we couldn't find the time yet to fix this issue, fakhri will upload the backups to the S3 manually using script

dodiws commented 2 years ago

Cron job failed when uploading the backups to S3 because AWS credentials is only accessible for ubuntu user whereas current cron uses root user to run the job. The solution is to use ubuntu user on AWS related cron job.

To change user for cron job, open /etc/crontab and find this line:

30 4 * * * root ... ngm_reporthub_backup.sh ...
30 16 * * * root ... ngm_reporthub_backup.sh ...

Change to:

30 4 * * * ubuntu ... ngm_reporthub_backup.sh ...
30 16 * * * ubuntu ... ngm_reporthub_backup.sh ...

Make /var/log/cronjob.log writable for ubuntu user.

chmod go+w /var/log/cronjob.log

Timestamp added on cronjob logs. Additional cron job added for archiving /var/log/cronjob.log when it's size exceed 10MB limit.

Crontab file attached as backup because it's not included in git repository.