scientist-softserv / scholarworks

Cal State Hyrax
0 stars 0 forks source link

Fixity Check Cron Job #17

Closed crisr15 closed 11 months ago

crisr15 commented 1 year ago

Summary

Fixity checking job now works, but we need to create a cron job for it to run automatically.

Acceptance Criteria

Testing Instructions

Not End user testable. Developers can move ticket to client QA once it has been tested locally.

Notes

This will require work with the ansible scripts. Will need pair time with Rob

aprilrieger commented 1 year ago

0 3 * * * cd /app/samvera/hyrax-webapp && bundle exec rake calstate:all_files_fixity_check >> /path/to/log/file.log 2>&1

Since the whenever gem is not installed we will need to add the cron job to the server to run.

By specifying "0 3 *", you ensure that the cron job runs every day at 3:00 AM, regardless of the specific day, month, or day of the week.

The part "0 3 * * *" is the schedule or timing specification in a cron job. It determines when the cron job will be executed. Let's break down each component:

The first field represents minutes (0-59).
The second field represents hours in 24-hour format (0-23).
The third field represents days of the month (1-31).
The fourth field represents months (1-12).
The fifth field represents days of the week (0-7 or Sunday-Saturday, where both 0 and 7 represent Sunday).
In the example "0 3 * * *", the cron job is scheduled to run at 3:00 AM every day. Here's how each field is interpreted:
bkiahstroud commented 1 year ago

@aprilrieger Is this 3am UTC or Pacific?

aprilrieger commented 1 year ago

@bkiahstroud Depends on the system's time zone configuration. By default, cron jobs are executed using the system's local time zone.

When ssh'ed into the server you can

echo $TZ

to find out.

aprilrieger commented 1 year ago

@bkiahstroud Oh niiiiice, we can also set it to the specific timezone with:

0 3 * * * TZ=PST cd /path/to/your/project && bundle exec rake calstate:all_files_fixity_check >> /path/to/log/file.log 2>&1

Thanks for the great question!

bkiahstroud commented 1 year ago

Approved ✅

orangewolf commented 1 year ago

I'm confused about the status of this ticket - I don't see any corresponding update to the ansible scripts? doesn't feel like this is done until that happens.

aprilrieger commented 1 year ago

@orangewolf Crystal asked me to get this created so that when you are ready to pair with us we can get this onto the servers. Is there extra information or steps outlining the additional steps? Did I misunderstand the ask here?

This will require work with the ansible scripts. Will need pair time with Rob

aprilrieger commented 1 year ago

This is in code review till I can pair with Rob and a team mate on TT6 to integrate into ansible.

aprilrieger commented 1 year ago

This was added to the server and integrated into the calstate-devops ansible script from Rob.