Skip to content

Instantly share code, notes, and snippets.

@andygimma
Created September 24, 2021 21:54
Show Gist options
  • Save andygimma/bd147f9dc3210f173e76e683dbba8c56 to your computer and use it in GitHub Desktop.
Save andygimma/bd147f9dc3210f173e76e683dbba8c56 to your computer and use it in GitHub Desktop.
#! /bin/bash
### IMPORTANT ###
# Remove all 3 instances of /path/to/ and replaces them with proper paths
#################
logfile='/path/to/logs.txt'
start_text='Starting MGS_scraper.py'
current_time=$(date)
find_or_start_scraper() {
if ! ps -ef | grep "/path/to/MGS_scraper.py" | grep -v "grep"
then
python /path/to/MGS_scraper.py &
echo "$start_text $current_time" >> $logfile
fi
}
find_or_start_scraper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment