Skip to content

Instantly share code, notes, and snippets.

@bgrgicak
Created July 13, 2021 10:38
Show Gist options
  • Save bgrgicak/d39be1f0315be82d6b11266d78c65a79 to your computer and use it in GitHub Desktop.
Save bgrgicak/d39be1f0315be82d6b11266d78c65a79 to your computer and use it in GitHub Desktop.
WC Admin analytics import runner. Used to run https://gist.github.com/bgrgicak/de6c675c832276ae852cb3330f448e62 and restert it if ti fails.
#!/bin/bash
TOTAL=${1:-5}
echo "Import runner started"
while :
do
ACTIVE=$(ps -aux | grep import-wc-admin-orders.sh | grep -c -v grep)
echo "Active importers: $ACTIVE/$TOTAL"
if [ $ACTIVE -lt $TOTAL ]
then
echo "Starting new importer"
sh import-wc-admin-orders.sh &
fi
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment