mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
rhel8 ignores flock and kills us anyways
This commit is contained in:
parent
ba599aaca0
commit
0632f09bff
|
@ -342,14 +342,15 @@ def get_payload():
|
||||||
|
|
||||||
|
|
||||||
def utime(top):
|
def utime(top):
|
||||||
|
# avoid cleaners
|
||||||
i = 0
|
i = 0
|
||||||
files = [os.path.join(dp, p) for dp, dd, df in os.walk(top) for p in dd + df]
|
files = [os.path.join(dp, p) for dp, dd, df in os.walk(top) for p in dd + df]
|
||||||
while WINDOWS:
|
while WINDOWS or os.path.exists("/etc/systemd"):
|
||||||
t = int(time.time())
|
t = int(time.time())
|
||||||
if i:
|
if i:
|
||||||
msg("utime {}, {}".format(i, t))
|
msg("utime {}, {}".format(i, t))
|
||||||
|
|
||||||
for f in files:
|
for f in [top] + files:
|
||||||
os.utime(f, (t, t))
|
os.utime(f, (t, t))
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -374,16 +375,6 @@ def run(tmp, j2, ftp):
|
||||||
msg("sfxdir:", tmp)
|
msg("sfxdir:", tmp)
|
||||||
msg()
|
msg()
|
||||||
|
|
||||||
# block systemd-tmpfiles-clean.timer
|
|
||||||
try:
|
|
||||||
import fcntl
|
|
||||||
|
|
||||||
fd = os.open(tmp, os.O_RDONLY)
|
|
||||||
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
|
||||||
except Exception as ex:
|
|
||||||
if not WINDOWS:
|
|
||||||
msg("\033[31mflock:{!r}\033[0m".format(ex))
|
|
||||||
|
|
||||||
t = threading.Thread(target=utime, args=(tmp,))
|
t = threading.Thread(target=utime, args=(tmp,))
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
|
Loading…
Reference in a new issue