mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 04:07:13 +03:00
if running ./gb start and another gb is already bound on the port
then quickly exit(0) and have the bash keep alive loop exit the loop based on that return value. we can't use ./cleanexit file because it doesn't get remove and will mess up the main process that is running.
This commit is contained in:
parent
36fdbf2f5a
commit
0caf345850
22
main.cpp
22
main.cpp
@ -3094,8 +3094,10 @@ int main2 ( int argc , char *argv[] ) {
|
||||
// failing because another process is already running using this port
|
||||
//if ( ! g_udpServer.testBind ( g_hostdb.getMyPort() ) )
|
||||
if ( ! g_httpServer.m_tcp.testBind(g_hostdb.getMyHost()->m_httpPort,
|
||||
true)) // printmsg?
|
||||
return 1;
|
||||
true)) {// printmsg?
|
||||
// return 0 so keep alive bash loop exits
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int32_t *ips;
|
||||
// char tmp[64];
|
||||
@ -5339,10 +5341,20 @@ int install ( install_flag_konst_t installFlag , int32_t hostId , char *dir ,
|
||||
" ;"
|
||||
|
||||
// this doesn't always work so use
|
||||
// the cleanexit file approach
|
||||
//"EXITSTATUS=\\$? ; "
|
||||
// the cleanexit file approach.
|
||||
// but if we run a second gb accidentally
|
||||
// it would write a ./cleanexit file
|
||||
// to get out of its loop and it wouldn't
|
||||
// be deleted! crap. so try this again
|
||||
// for this short cases when we exit right
|
||||
// away.
|
||||
"EXITSTATUS=\\$? ; "
|
||||
// if gb does exit(0) then stop
|
||||
"if [ \\$EXITSTATUS = 0 ]; then break; fi;"
|
||||
|
||||
// stop if ./cleanexit is there
|
||||
// also stop if ./cleanexit is there
|
||||
// because the above exit(0) does not always
|
||||
// work for some strange reasons
|
||||
"if [ -f \"./cleanexit\" ]; then break; fi;"
|
||||
"%s"
|
||||
"ADDARGS='-r'\\$INC ; "
|
||||
|
Loading…
Reference in New Issue
Block a user