-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add refresh-cache script and crontab sample
Add script and crontab sample: - `scripts/refresh-cache`: can be run from a cron job to refresh the cache. - `scripts/refresh-cache.crontab`: sample user crontab for refreshing the cache daily. Signed-off-by: Nir Soffer <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
env_file=envs/regional-dr.yaml | ||
attempts=10 | ||
delay_seconds=60 | ||
|
||
test_dir="$(dirname $(dirname $0))" | ||
|
||
echo "$(date) Entering $test_dir" | ||
cd "$test_dir" | ||
|
||
echo "$(date) Activating virtual environment" | ||
source ../venv | ||
|
||
for i in $(seq 1 $attempts); do | ||
echo "$(date) Refreshing drenv cache (attempt $i/$attempts)" | ||
drenv cache -v "$env_file" && exit 0 | ||
sleep $delay_seconds | ||
done | ||
|
||
echo "Failed to refresh drenv cache" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# To refresh the cache daily, edit the user crotab (crontab -e) and add the | ||
# content bellow. | ||
# NOTES: | ||
# - update the path to the ramen directory. | ||
# - ensure all the tools are in the specified PATH. | ||
|
||
PATH=/bin:/usr/bin:/usr/local/bin | ||
|
||
0 3 * * * /home/github/ramen/test/scripts/refresh-cache |