mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-03-31 09:20:43 +08:00
18 lines
307 B
Python
18 lines
307 B
Python
#!/usr/bin/python
|
|
|
|
import fcntl
|
|
import sys
|
|
|
|
try:
|
|
f = open('/mnt/koji/.nagios_test', 'r')
|
|
f.close()
|
|
f = open('/mnt/koji/.nagios_test', 'w')
|
|
except IOError:
|
|
print "Could not create file"
|
|
sys.exit(2)
|
|
|
|
fcntl.flock(f, fcntl.LOCK_EX)
|
|
f.close()
|
|
print "File Locked Successfully"
|
|
sys.exit(0)
|