all repos — nasg @ f5c599cef923afe23974252f778dd4e4cb214b80

update.sh (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
#!/usr/bin/env bash

if [ -f "/tmp/petermolnar.net.generator.lock" ]; then
	exit 0;
fi;

lastfile="$(find /home/petermolnar.net/source/ -type f -name *.md -printf '%T+ %p\n' | sort | tail -n1 | awk '{print $2}')"; 
lastfilemod=$(stat -c %Y "$lastfile"); 
lastrunfile="/tmp/generator_last_run";  
lastrun=0; 

if [ -f "$lastrunfile" ]; then 
	lastrun=$(stat -c %Y "$lastrunfile"); 
fi; 

if [ "$lastrun" -lt "$lastfilemod" ]; then 
	cd /home/petermolnar.net/src; ../.venv/bin/python3.5 generator.py; 
fi;

exit 0;