Skip to content

Instantly share code, notes, and snippets.

@TUNER88
Created December 14, 2016 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TUNER88/4afa389ec6fff64f7b2388ecda87c3ce to your computer and use it in GitHub Desktop.
Save TUNER88/4afa389ec6fff64f7b2388ecda87c3ce to your computer and use it in GitHub Desktop.
Workaround to bypass limitations of cron command frequency (some hosters allow to trigger cron jobs only each 15 or 30 minutes)
#!/bin/bash
COMMANDS[0]="php current/artisan schedule:run"
COMMANDS[1]="php current/artisan queue:work --tries=3"
ITERATIONS=30 # how often should be the commands repeated
INTERVAL=60 # how should the pause between iterations (in seconds)
for ((i=1; i<=$ITERATIONS; i++)); do
for COMMAND in "${COMMANDS[@]}"; do
$COMMAND >> /dev/null 2>&1 &
done
sleep $INTERVAL
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment