Created
August 21, 2016 13:20
-
-
Save lotka/52aa24eb088f61da69615a485322f554 to your computer and use it in GitHub Desktop.
watcher
This file contains hidden or 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 | |
while python sleeptill.py *.tex; do ./tex.sh; done |
This file contains hidden or 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
import os | |
import sys | |
import time | |
def get_times(file_list): | |
times = [] | |
for filename in file_list: | |
times.append(os.stat(filename).st_mtime) | |
return times | |
def main(): | |
print 'watching ', sys.argv[1:] | |
prev_times = get_times(sys.argv[1:]) | |
while True: | |
time.sleep(1) | |
new_times = get_times(sys.argv[1:]) | |
if new_times != prev_times: | |
break | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment