File tree 1 file changed +7
-16
lines changed
1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -571,30 +571,21 @@ def main():
571
571
572
572
start_rest_thread (logger )
573
573
574
- # Ideally the signal handlers should be installed as early as possible,
575
- # however that does not play well with the worker pool communication used by do_sync().
576
- signal .signal (signal .SIGTERM , signal_handler )
577
- signal .signal (signal .SIGINT , signal_handler )
578
-
579
- # Start Tomcat last. It will be the foreground process.
574
+ # Start Tomcat last.
580
575
logger .info ("Starting Tomcat" )
581
- global tomcat_popen
582
576
tomcat_popen = subprocess .Popen ([os .path .join (tomcat_root , 'bin' ,
583
577
'catalina.sh' ),
584
578
'run' ])
585
- tomcat_popen .wait ()
586
-
587
579
588
- def signal_handler (signum , frame ):
589
- print ("Received signal {}" .format (signum ))
590
-
591
- global tomcat_popen
580
+ sigset = set ()
581
+ sigset .add (signal .SIGTERM )
582
+ sigset .add (signal .SIGINT )
583
+ signum = signal .sigwait (sigset )
584
+ logger .info ("Received signal {}" .format (signum ))
592
585
if tomcat_popen :
593
- print ("Terminating Tomcat {}" .format (tomcat_popen ))
586
+ logger . info ("Terminating Tomcat {}" .format (tomcat_popen ))
594
587
tomcat_popen .terminate ()
595
588
596
- sys .exit (0 )
597
-
598
589
599
590
if __name__ == "__main__" :
600
591
main ()
You can’t perform that action at this time.
0 commit comments