Created
September 24, 2021 21:54
-
-
Save andygimma/bd147f9dc3210f173e76e683dbba8c56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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