Skip to content

Instantly share code, notes, and snippets.

@redacted
Created January 29, 2015 17:11
Show Gist options
  • Save redacted/26d95891f682ad31b0d7 to your computer and use it in GitHub Desktop.
Save redacted/26d95891f682ad31b0d7 to your computer and use it in GitHub Desktop.
Automating a processing pipeline
#!/bin/bash
get_insights() { python insights_lastNdays.py; }
build_reports() { python gen_weekly_plots.py; }
upload_reports() { python upload_all.py; }
# functions to call in order
declare -a functions=(get_insights build_reports upload_reports)
# make sure we are in the right directory for paths!
cd "$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
# first, download the facebook report
for f in ${functions[@]}; do
echo $f;
$f 2>&1 /tmp/cron_work.log
while [ $? -ne 0 ]; do
echo "Retrying in 5m"
sleep 300;
$f 2>&1 /tmp/cron_work.log
done
sleep 10;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment