@@ -1380,15 +1380,15 @@ bool ProxySQL_daemonize_phase2() {
1380
1380
* @note This function does not return if an error occurs; it exits the process.
1381
1381
*/
1382
1382
void 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
+
1383
1386
// Check if the global variable execute_on_exit_failure is NULL
1384
1387
if (GloVars.execute_on_exit_failure == NULL ) {
1385
1388
// Exit the function if the variable is not set
1386
1389
return ;
1387
1390
}
1388
1391
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
-
1392
1392
// Fork a child process
1393
1393
pid_t cpid;
1394
1394
cpid = fork ();
@@ -1474,6 +1474,16 @@ bool ProxySQL_daemonize_phase3() {
1474
1474
proxy_info (" ProxySQL SHA1 checksum: %s\n " , binary_sha1);
1475
1475
}
1476
1476
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
+ }
1477
1487
parent_close_error_log ();
1478
1488
return false ;
1479
1489
}
0 commit comments