def makeLockFile(self): if not self.cfg.zserver_read_only_mode: # lock_file is used for the benefit of zctl-like systems, so they # can tell whether Zope is already running before attempting to # fire it off again. # # We aren't concerned about locking the file to protect against # other Zope instances running from our CLIENT_HOME, we just # try to lock the file to signal that zctl should not try to # start Zope if *it* can't lock the file; we don't panic # if we can't lock it. # we need a separate lock file because on win32, locks are not # advisory, otherwise we would just use the pid file from Zope2.Startup.misc.lock_file import lock_file lock_filename = self.cfg.lock_filename try: if os.path.exists(lock_filename): os.unlink(lock_filename) self.lockfile = open(lock_filename, "w") lock_file(self.lockfile) self.lockfile.write(str(os.getpid())) self.lockfile.flush() except (IOError, WindowsError): pass
def makeLockFile(self): if not self.cfg.zserver_read_only_mode: from Zope2.Startup.misc.lock_file import lock_file lock_filename = self.cfg.lock_filename try: if os.path.exists(lock_filename): os.unlink(lock_filename) lockfile = open(lock_filename, 'w') lock_file(lockfile) lockfile.write(str(self.parent_pid)) lockfile.flush() except IOError: pass
def makeLockFile(self): if not self.cfg.zserver_read_only_mode: # lock_file is used for the benefit of zctl-like systems, so they # can tell whether Zope is already running before attempting to # fire it off again. # # We aren't concerned about locking the file to protect against # other Zope instances running from our CLIENT_HOME, we just # try to lock the file to signal that zctl should not try to # start Zope if *it* can't lock the file; we don't panic # if we can't lock it. # we need a separate lock file because on win32, locks are not # advisory, otherwise we would just use the pid file from Zope2.Startup.misc.lock_file import lock_file lock_filename = self.cfg.lock_filename try: if os.path.exists(lock_filename): os.unlink(lock_filename) self.lockfile = open(lock_filename, 'w') lock_file(self.lockfile) self.lockfile.write(str(os.getpid())) self.lockfile.flush() except IOError: pass