Jun-20-2019, 02:27 AM
i wrote these four commands the other day:
wait_for_all_files_to_exist.py:
changed variable next to nxet.
wait_for_all_files_to_exist.py:
#!/usr/bin/env python3 from sys import argv from time import sleep,time as secs import os step = 1/4 exe = argv.pop(0) nxet = int(secs())+0.5 if not argv: exit('need one or more file names') while 1: e = 1 for n in argv: if not os.path.exists(n): e = 0 if e: break nxet += step diff = nxet-secs() while diff<0: nxet += step diff = nxet-secs() sleep(diff) exit(0)wait_for_all_files_to_not_exist.py:
#!/usr/bin/env python3 from sys import argv from time import sleep,time as secs import os step = 1/4 exe = argv.pop(0) nxet = int(secs())+0.5 if not argv: exit('need one or more file names') while 1: e = 1 for n in argv: if os.path.exists(n): e = 0 if e: break nxet += step diff = nxet-secs() while diff<0: nxet += step diff = nxet-secs() sleep(diff) exit(0)wait_for_any_file_to_exist.py:
#!/usr/bin/env python3 from sys import argv from time import sleep,time as secs import os step = 1/4 exe = argv.pop(0) nxet = int(secs())+0.5 if not argv: exit('need one or more file names') while 1: e = 0 for n in argv: if os.path.exists(n): e = 1 if e: break nxet += step diff = nxet-secs() while diff<0: nxet += step diff = nxet-secs() sleep(diff) exit(0)wait_for_any_file_to_not_exist.py:
#!/usr/bin/env python3 from sys import argv from time import sleep,time as secs import os step = 1/4 exe = argv.pop(0) nxet = int(secs())+0.5 if not argv: exit('need one or more file names') while 1: e = 0 for n in argv: if not os.path.exists(n): e = 1 if e: break nxet += step diff = nxet-secs() while diff<0: nxet += step diff = nxet-secs() sleep(diff) exit(0)edit:
changed variable next to nxet.