mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Add no forking option to startup arguments
This commit is contained in:
parent
665a6435ef
commit
464fa1f8a3
2 changed files with 10 additions and 9 deletions
|
@ -93,7 +93,7 @@ def main():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--pidfile', help='Create a pid file (only relevant when running as a daemon)')
|
'--pidfile', help='Create a pid file (only relevant when running as a daemon)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--windowsservice', action='store_true', help='Running as a windows service.')
|
'--nofork', action='store_true', help='Start PlexPy as a service, do not fork when restarting')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -118,9 +118,9 @@ def main():
|
||||||
plexpy.DAEMON = True
|
plexpy.DAEMON = True
|
||||||
plexpy.QUIET = True
|
plexpy.QUIET = True
|
||||||
|
|
||||||
if args.windowsservice:
|
if args.nofork:
|
||||||
plexpy.WINDOWSSERVICE = True
|
plexpy.NOFORK = True
|
||||||
logger.info("Running as windows service: %s", plexpy.WINDOWSSERVICE)
|
logger.info("PlexPy is running as a service, it will not fork when restarted.")
|
||||||
|
|
||||||
if args.pidfile:
|
if args.pidfile:
|
||||||
plexpy.PIDFILE = str(args.pidfile)
|
plexpy.PIDFILE = str(args.pidfile)
|
||||||
|
|
|
@ -54,7 +54,7 @@ VERBOSE = True
|
||||||
DAEMON = False
|
DAEMON = False
|
||||||
CREATEPID = False
|
CREATEPID = False
|
||||||
PIDFILE = None
|
PIDFILE = None
|
||||||
WINDOWSSERVICE = False
|
NOFORK = False
|
||||||
|
|
||||||
SCHED = BackgroundScheduler()
|
SCHED = BackgroundScheduler()
|
||||||
SCHED_LOCK = threading.Lock()
|
SCHED_LOCK = threading.Lock()
|
||||||
|
@ -993,14 +993,15 @@ def shutdown(restart=False, update=False):
|
||||||
|
|
||||||
# os.execv fails with spaced names on Windows
|
# os.execv fails with spaced names on Windows
|
||||||
# https://bugs.python.org/issue19066
|
# https://bugs.python.org/issue19066
|
||||||
if os.name == 'nt' and plexpy.WINDOWSSERVICE:
|
if NOFORK:
|
||||||
logger.info("Running as windows service, no need to fork.")
|
logger.info('Running as service, not forking. Exiting...')
|
||||||
elif os.name == 'nt':
|
elif os.name == 'nt':
|
||||||
|
logger.info('Restarting PlexPy with %s', args)
|
||||||
subprocess.Popen(args, cwd=os.getcwd())
|
subprocess.Popen(args, cwd=os.getcwd())
|
||||||
logger.info('Restarting PlexPy with %s', args)
|
|
||||||
else:
|
else:
|
||||||
os.execv(exe, args)
|
|
||||||
logger.info('Restarting PlexPy with %s', args)
|
logger.info('Restarting PlexPy with %s', args)
|
||||||
|
os.execv(exe, args)
|
||||||
|
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue