- if self.initscriptchanged:
- # unconditionnally install and enable the generic vinit script
- # this one checks for the existence of the slice initscript
- self.install_and_enable_vinit()
- # install or remove the slice inistscript, as instructed by the initscript tag
- sliver_initscript="/vservers/%s/etc/rc.d/init.d/vinit.slice"%self.name
- if not self.initscript:
- logger.log("sliver_vs: %s: unlinking initscript %s"%(self.name,sliver_initscript))
- os.unlink(sliver_initscript)
- else:
- logger.log("sliver_vs: %s: installing new initscript %s"%(self.name,sliver_initscript))
- try:
- flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC
- fd = os.open(sliver_initscript, flags, 0755)
- os.write(fd, self.initscript)
- os.close(fd)
- except:
- logger.log_exc("sliver_vs: %s - could not install initscript"%self.name)
- tools.close_nonstandard_fds()
- vserver.VServer.start(self)
- os._exit(0)
+ # VServer.start calls fork() internally,
+ # so just close the nonstandard fds and fork once to avoid creating zombies
+ tools.close_nonstandard_fds()
+ vserver.VServer.start(self)
+ os._exit(0)