Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more documentation to correction cron job #197

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,30 @@
## `get_correct-set.sh`

On the production machine `get_correct_set.sh` is set to run as cronjob on the root user.
For the cron job to run successfully a virtual environment for Python 3.8+ must be created in `/home/cs334/mirrulations/scripts/.venv`.

The current cron job is as follows:
The command to do so is as follows

```bash
cd /home/cs334/mirrulations/scripts
/usr/bin/python3.8 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
deactivate
```

Now `get_correct_set.sh` will be able to be run as a script.
To add the cronjob to the root users crontab run the following

```bash
sudo crontab -e
```

Select an editor you feel comfortable with the line below if it is not already there

```
0 */6 * * * /home/cs334/mirruations/scripts/get_correct_set.sh
```

This line tells the cron daemon to run the script every 6 hours.
Output logs are stored in `/var/log/mirruations_counts.log`.
2 changes: 1 addition & 1 deletion scripts/get_correct_set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ START_TIME=$(date -Iseconds)

echo "$START_TIME: Running" >> $LOG_FILE
cd $WORK_DIR
source .venv/bin/python3/activate
source .venv/bin/activate

./get_counts.py -o "/tmp/mirrulations_$START_TIME.json" redis 2>> $LOG_FILE &&
./correct_counts.py -i "/tmp/mirrulations_$START_TIME.json" -o "/tmp/mirrulations_${START_TIME}_corrected.json" 2>> $LOG_FILE &&
Expand Down
Loading