@@ -1380,15 +1380,15 @@ bool ProxySQL_daemonize_phase2() {
13801380 * @note This function does not return if an error occurs; it exits the process.
13811381 */
13821382void call_execute_on_exit_failure () {
1383+ // Log a message indicating the attempt to call the external script
1384+ proxy_info (" Trying to call external script after exit failure: %s\n " , GloVars.execute_on_exit_failure ? GloVars.execute_on_exit_failure : " (null)" );
1385+
13831386 // Check if the global variable execute_on_exit_failure is NULL
13841387 if (GloVars.execute_on_exit_failure == NULL ) {
13851388 // Exit the function if the variable is not set
13861389 return ;
13871390 }
13881391
1389- // Log a message indicating the attempt to call the external script
1390- proxy_error (" Trying to call external script after exit failure: %s\n " , GloVars.execute_on_exit_failure );
1391-
13921392 // Fork a child process
13931393 pid_t cpid;
13941394 cpid = fork ();
@@ -1474,6 +1474,16 @@ bool ProxySQL_daemonize_phase3() {
14741474 proxy_info (" ProxySQL SHA1 checksum: %s\n " , binary_sha1);
14751475 }
14761476 call_execute_on_exit_failure ();
1477+ // automatic reload of TLS certificates after a crash , see #4658
1478+ std::string msg;
1479+ ProxySQL_create_or_load_TLS (false , msg);
1480+ // Honor --initial after a crash , see #4659
1481+ if (GloVars.__cmd_proxysql_initial ==true ) {
1482+ std::cerr << " Renaming database file " << GloVars.admindb << endl;
1483+ char *newpath=(char *)malloc (strlen (GloVars.admindb )+8 );
1484+ sprintf (newpath," %s.bak" ,GloVars.admindb );
1485+ rename (GloVars.admindb ,newpath); // FIXME: should we check return value, or ignore whatever it successed or not?
1486+ }
14771487 parent_close_error_log ();
14781488 return false ;
14791489 }
0 commit comments