def log(self,msg):
if self.logfile:
try:
- fd = os.open(self.logfile,"a", 0600)
+ fd = os.open(self.logfile,os.O_WRONLY | os.O_CREAT | os.O_APPEND, 0600)
if not msg.endswith('\n'): msg += '\n'
os.write(fd, '%s: %s' % (time.asctime(time.gmtime()), msg))
os.close(fd)
except:
- print msg
+ print '%s: (%s failed to open) %s'%(time.asctime(time.gmtime()),self.logfile,msg)
def have_limits_changed(self):
return self.rlimits_changed
self.set_resources()
vserverimpl.setup_done(self.ctx)
- def __prep(self, runlevel, log):
+ def __prep(self, runlevel):
""" Perform all the crap that the vserver script does before
actually executing the startup scripts. """
if fd != 0:
os.dup2(fd, 0)
os.close(fd)
+
+ # perform pre-init cleanup
+ self.__prep(runlevel)
+
self.config.cache_it()
self.__do_chroot()
log = open("/var/log/boot.log", "a", 0)
print >>log, ("%s: starting the virtual server %s" %
(time.asctime(time.gmtime()), self.name))
-
- # perform pre-init cleanup
- self.__prep(runlevel, log)
-
# execute each init script in turn
# XXX - we don't support all scripts that vserver script does
self.__do_chcontext(state_file)