增加log日志,关机的锁
This commit is contained in:
parent
5e1d9d36be
commit
993511903f
|
@ -739,9 +739,10 @@ def LockedPreventShutdown():
|
|||
try:
|
||||
if not locked:
|
||||
fcntl.flock(pidfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
logging.info("Has been locked.")
|
||||
logging.info("Shutdown Has been locked...")
|
||||
locked = True
|
||||
except:
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
locked = False
|
||||
logging.error("file cannot be locked.")
|
||||
return False
|
||||
|
@ -751,13 +752,15 @@ def unLockedEnableShutdown():
|
|||
global pidfile
|
||||
global locked
|
||||
if not pidfile:
|
||||
logging.errr("pidfile file disc is None...")
|
||||
return False
|
||||
try:
|
||||
fcntl.flock(pidfile, fcntl.LOCK_UN)
|
||||
pidfile.close()
|
||||
locked = False
|
||||
logging.info("Has been unlocked.")
|
||||
except:
|
||||
logging.info("Shutdown Has been unlocked...")
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
logging.error("unlock failed.")
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in New Issue