diff --git a/nodeapp.php b/nodeapp.php index f704e41..f54f858 100644 --- a/nodeapp.php +++ b/nodeapp.php @@ -43,6 +43,17 @@ public function hcpp_runuser( $cmd ) { */ public function hcpp_rebooted() { + // Wait up to 60 additional seconds for MySQL to start + $i = 0; + while ( $i < 60 ) { + $i++; + $mysql = shell_exec( 'systemctl is-active mysql' ); + if ( trim( $mysql ) == 'active' ) { + break; + } + sleep( 1 ); + } + // Restart all PM2 apps for all user accounts $users = scandir('/home'); global $hcpp;