Created
December 10, 2018 08:53
-
-
Save gwpl/22b3c3e66711489b8d36cf8e5923c308 to your computer and use it in GitHub Desktop.
Checks if amount of files in directory has changed, if not than it executes killall to let thing restart in a loop
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 | |
counterf=no_of_files_last_time.txt | |
tmpf="$(mktemp)" | |
counter_old="$(cat "$counterf")" | |
echo -n 'Missing: ' | |
comm -23 <(sort -u sites_source.txt) <(ls -1|sort -u)|wc -l | |
echo -n 'Total: ' | |
sort -u sites_source.txt|wc -l | |
echo -n 'Files: ' | |
counter_new="$(find -type f |wc -l)" | |
echo ${counter_new} |tee "$tmpf" | |
df -h . | |
if cmp -s "$counterf" "$tmpf"; then | |
echo Counters SAME - Metric FAILED | |
echo Trying to reboot things | |
#killall -v loop_tumblr_crawler.sh | |
#killall -v tumblr-photo-video-ripper.py | |
killall -v python | |
date --iso-8601=seconds | |
else | |
echo Counters differ - Metric OK | |
cat "$tmpf" > "$counterf" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment