Server IP : 127.0.0.2 / Your IP : 3.139.86.62 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/odoo/setup/win32/ |
Upload File : |
# -*- coding: utf-8 -*- import servicemanager import win32api import win32process import win32service import win32serviceutil import subprocess import sys from os.path import dirname, join, split execfile(join(dirname(__file__), '..', 'server', 'odoo', 'release.py')) class OdooService(win32serviceutil.ServiceFramework): _svc_name_ = nt_service_name _svc_display_name_ = "%s %s" % (nt_service_name, serie) def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.odooprocess = None # Reference to the server's process def SvcStop(self): # Before we do anything, tell the SCM we are starting the stop process. self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # Stop the running Odoo: say it's a normal exit win32api.TerminateProcess(int(self.odooprocess._handle), 0) servicemanager.LogInfoMsg("Odoo stopped correctly") def SvcDoRun(self): # We start Odoo as an independent process, but we keep its handle service_dir = dirname(sys.argv[0]) server_dir = split(service_dir)[0] server_path = join(server_dir, 'server', 'odoo-bin.exe') self.odooprocess = subprocess.Popen( [server_path], cwd=server_dir, creationflags=win32process.CREATE_NO_WINDOW ) servicemanager.LogInfoMsg('Odoo up and running') # exit with same exit code as Odoo process sys.exit(self.odooprocess.wait()) def option_handler(opts): # configure the service to auto restart on failures... subprocess.call([ 'sc', 'failure', nt_service_name, 'reset=', '0', 'actions=', 'restart/0/restart/0/restart/0' ]) if __name__ == '__main__': win32serviceutil.HandleCommandLine(OdooService, customOptionHandler=option_handler)