@@ -953,7 +953,7 @@ protected static function parseCommand()
953
953
case 'stop ' :
954
954
if ($ command2 === '-g ' ) {
955
955
static ::$ _gracefulStop = true ;
956
- $ sig = \SIGTERM ;
956
+ $ sig = \SIGHUP ;
957
957
static ::log ("Workerman[ $ start_file] is gracefully stopping ... " );
958
958
} else {
959
959
static ::$ _gracefulStop = false ;
@@ -1101,8 +1101,10 @@ protected static function installSignal()
1101
1101
$ signalHandler = '\Workerman\Worker::signalHandler ' ;
1102
1102
// stop
1103
1103
\pcntl_signal (\SIGINT , $ signalHandler , false );
1104
- // graceful stop
1104
+ // stop
1105
1105
\pcntl_signal (\SIGTERM , $ signalHandler , false );
1106
+ // graceful stop
1107
+ \pcntl_signal (\SIGHUP , $ signalHandler , false );
1106
1108
// reload
1107
1109
\pcntl_signal (\SIGUSR1 , $ signalHandler , false );
1108
1110
// graceful reload
@@ -1128,8 +1130,10 @@ protected static function reinstallSignal()
1128
1130
$ signalHandler = '\Workerman\Worker::signalHandler ' ;
1129
1131
// uninstall stop signal handler
1130
1132
\pcntl_signal (\SIGINT , \SIG_IGN , false );
1131
- // uninstall graceful stop signal handler
1133
+ // uninstall stop signal handler
1132
1134
\pcntl_signal (\SIGTERM , \SIG_IGN , false );
1135
+ // uninstall graceful stop signal handler
1136
+ \pcntl_signal (\SIGHUP , \SIG_IGN , false );
1133
1137
// uninstall reload signal handler
1134
1138
\pcntl_signal (\SIGUSR1 , \SIG_IGN , false );
1135
1139
// uninstall graceful reload signal handler
@@ -1141,7 +1145,7 @@ protected static function reinstallSignal()
1141
1145
// reinstall stop signal handler
1142
1146
static ::$ globalEvent ->add (\SIGINT , EventInterface::EV_SIGNAL , $ signalHandler );
1143
1147
// reinstall graceful stop signal handler
1144
- static ::$ globalEvent ->add (\SIGTERM , EventInterface::EV_SIGNAL , $ signalHandler );
1148
+ static ::$ globalEvent ->add (\SIGHUP , EventInterface::EV_SIGNAL , $ signalHandler );
1145
1149
// reinstall reload signal handler
1146
1150
static ::$ globalEvent ->add (\SIGUSR1 , EventInterface::EV_SIGNAL , $ signalHandler );
1147
1151
// reinstall graceful reload signal handler
@@ -1162,11 +1166,12 @@ public static function signalHandler($signal)
1162
1166
switch ($ signal ) {
1163
1167
// Stop.
1164
1168
case \SIGINT :
1169
+ case \SIGTERM :
1165
1170
static ::$ _gracefulStop = false ;
1166
1171
static ::stopAll ();
1167
1172
break ;
1168
1173
// Graceful stop.
1169
- case \SIGTERM :
1174
+ case \SIGHUP :
1170
1175
static ::$ _gracefulStop = true ;
1171
1176
static ::stopAll ();
1172
1177
break ;
@@ -1826,7 +1831,7 @@ public static function stopAll()
1826
1831
$ worker_pid_array = static ::getAllWorkerPids ();
1827
1832
// Send stop signal to all child processes.
1828
1833
if (static ::$ _gracefulStop ) {
1829
- $ sig = \SIGTERM ;
1834
+ $ sig = \SIGHUP ;
1830
1835
} else {
1831
1836
$ sig = \SIGINT ;
1832
1837
}
0 commit comments