aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Timber <dxdt@dev.snart.me>2024-11-12 01:17:31 +0100
committerDavid Timber <dxdt@dev.snart.me>2024-11-12 01:17:31 +0100
commitbe3b15d64e9f6b8c2489b296c7f4b63487aa5564 (patch)
treeae9a248243f7d5984cb989bb69dae89d232f03cb
parentb52bb37f1446b8feb3934d1207da21ffd4fd637c (diff)
Run every hour for one hour, rather than 5 minutes
-rw-r--r--.github/workflows/scheduled-tasks.yml7
-rwxr-xr-xviewcount-tothemoooon/vc-thm6
2 files changed, 7 insertions, 6 deletions
diff --git a/.github/workflows/scheduled-tasks.yml b/.github/workflows/scheduled-tasks.yml
index e392992..d5ff84f 100644
--- a/.github/workflows/scheduled-tasks.yml
+++ b/.github/workflows/scheduled-tasks.yml
@@ -2,17 +2,20 @@ name: Shitcoding
run-name: Running scheduled tasks
on:
schedule:
+# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
+# > The shortest interval you can run scheduled workflows is once every 5 minutes.
- cron: '*/5 * * * *'
workflow_dispatch:
jobs:
Do-snapshot:
name: "vc-thm"
runs-on: ubuntu-latest
+ timeout-minutes: 65
steps:
- uses: actions/checkout@v3
- name: Run vc-thm
run: |
- ./viewcount-tothemoooon/vc-thm 'https://okky.kr/articles/1519671' &
- ./viewcount-tothemoooon/vc-thm 'https://okky.kr/articles/1519674' &
+ ./viewcount-tothemoooon/vc-thm 'https://okky.kr/articles/1519671' 3600 &
+ ./viewcount-tothemoooon/vc-thm 'https://okky.kr/articles/1519674' 3600 &
wait
wait
diff --git a/viewcount-tothemoooon/vc-thm b/viewcount-tothemoooon/vc-thm
index d285edf..0f8a0a8 100755
--- a/viewcount-tothemoooon/vc-thm
+++ b/viewcount-tothemoooon/vc-thm
@@ -17,14 +17,12 @@ pull_url () {
done
}
-if [ -z "$1" ]; then
+if [ "$#" -lt 2 ]; then
echo "Usage: $ARGV0 <URL> [TIMEOUT]" >& 2
exit 2
fi
-# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
-# > The shortest interval you can run scheduled workflows is once every 5 minutes.
-[ -z "$2" ] && TIMEOUT=270 || TIMEOUT="$2"
+TIMEOUT="$2"
set -e