Skip to content

Commit

Permalink
Add more documentation to correction cron job
Browse files Browse the repository at this point in the history
  • Loading branch information
jpappel committed Oct 30, 2024
1 parent b72f16b commit 53bfe2f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
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

0 comments on commit 53bfe2f

Please sign in to comment.