Skip to content

Commit

Permalink
Add script to regenerate data
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjcastillo committed Feb 2, 2024
1 parent 8bf4f36 commit 525f16b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions deployment/add_cron_job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e

source config.sh

# Define the command to add
JOB="*/5 * * * * $PROJECT_DIR/.venv/bin/python $PROJECT_DIR/$PROJECT_SUBDIR/manage.py regenerate_data"

# Check if the job already exists
(crontab -l | grep -q "$JOB") && echo "Cron job already exists" || (crontab -l 2>/dev/null; echo "$JOB") | crontab -

# Confirmation message
echo "Cron job added successfully"
2 changes: 1 addition & 1 deletion src/app/management/commands/regenerate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Command(BaseCommand):

def handle(self, *args, **kwargs):
# Assuming you have functions to delete the old data.
# delete_old_data()
delete_data()

# Your data creation logic here
create_contacts(count=100)
Expand Down

0 comments on commit 525f16b

Please sign in to comment.