diff options
author | Peter Baumann <p.baumann@jacobs-university.de> | 2010-07-22 18:40:58 +0200 |
---|---|---|
committer | www-data <www-data@ubuntu.localdomain> | 2010-07-22 18:59:27 +0200 |
commit | 0668e010113735594a2c570c6f1d890fed78337f (patch) | |
tree | cdeebd51daa6da90d21488292b6225ebca163034 | |
parent | 6266bdb85ce90b10e2ae791d747d5dcaf3bbe77a (diff) | |
download | rasdaman-upstream-0668e010113735594a2c570c6f1d890fed78337f.tar.gz rasdaman-upstream-0668e010113735594a2c570c6f1d890fed78337f.tar.xz rasdaman-upstream-0668e010113735594a2c570c6f1d890fed78337f.zip |
PB: file path cleanup, such as removing RMANHOME variable usage
-rw-r--r-- | bin/rasmgr.conf.in | 25 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | httpserver/init.cc | 2 | ||||
-rw-r--r-- | include/globals.hh | 7 | ||||
-rw-r--r-- | server/rasserver_config.cc | 29 |
5 files changed, 26 insertions, 39 deletions
diff --git a/bin/rasmgr.conf.in b/bin/rasmgr.conf.in index 80cbaf9..245cc6d 100644 --- a/bin/rasmgr.conf.in +++ b/bin/rasmgr.conf.in @@ -77,36 +77,41 @@ define srv N1 -host floridita -type n -port 7002 -dbh rasdaman_host # provide a specific timeout in seconds determining # after how many seconds of inactivity the server will # detach from the client, aborting any open transaction -change srv N1 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N1 -countdown 200 -autorestart on -xp --timeout 300 # more server definitions, following the above pattern; add any number you want. # Parameters can be adjusted individually, but be sure to avoid a clash in the ports. define srv N1 -host floridita -type n -port 7003 -dbh rasdaman_host -change srv N1 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N1 -countdown 200 -autorestart on -xp --timeout 300 define srv N2 -host floridita -type n -port 7004 -dbh rasdaman_host -change srv N2 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N2 -countdown 200 -autorestart on -xp --timeout 300 define srv N3 -host floridita -type n -port 7005 -dbh rasdaman_host -change srv N3 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N3 -countdown 200 -autorestart on -xp --timeout 300 define srv N4 -host floridita -type n -port 7006 -dbh rasdaman_host -change srv N4 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N4 -countdown 200 -autorestart on -xp --timeout 300 define srv N5 -host floridita -type n -port 7007 -dbh rasdaman_host -change srv N5 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N5 -countdown 200 -autorestart on -xp --timeout 300 define srv N6 -host floridita -type n -port 7008 -dbh rasdaman_host -change srv N6 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N6 -countdown 200 -autorestart on -xp --timeout 300 define srv N7 -host floridita -type n -port 7009 -dbh rasdaman_host -change srv N7 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N7 -countdown 200 -autorestart on -xp --timeout 300 define srv N8 -host floridita -type n -port 7010 -dbh rasdaman_host -change srv N8 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N8 -countdown 200 -autorestart on -xp --timeout 300 define srv N9 -host floridita -type n -port 7011 -dbh rasdaman_host -change srv N9 -countdown 1000 -autorestart on -xp --timeout 300 +change srv N9 -countdown 200 -autorestart on -xp --timeout 300 + +# further, we define one RPC type server; this protocol is deprecated, +# but rview still needs it. +define srv P1 -host floridita -type n -port 0x29999901 -dbh rasdaman_host +change srv P1 -countdown 200 -autorestart on -xp --timeout 300 # end of rasmgr.conf diff --git a/configure.ac b/configure.ac index 77615aa..edd9492 100644 --- a/configure.ac +++ b/configure.ac @@ -333,7 +333,7 @@ AC_SUBST(logdir) CXXFLAGS="$CXXFLAGS -DSHARE_DATA_DIR=\\\"\$(pkgdatadir)/\\\"" CXXFLAGS="$CXXFLAGS -DCONFDIR=\\\"\$(sysconfdir)/\\\"" CXXFLAGS="$CXXFLAGS -DBINDIR=\\\"\$(bindir)/\\\"" -CXXFLAGS="$CXXFLAGS -DABSOLUTE_LOG_DIR=\\\"\$(logdir)/\\\"" +CXXFLAGS="$CXXFLAGS -DLOGDIR=\\\"\$(logdir)/\\\"" AC_OUTPUT diff --git a/httpserver/init.cc b/httpserver/init.cc index b58ce35..964f1e2 100644 --- a/httpserver/init.cc +++ b/httpserver/init.cc @@ -81,7 +81,7 @@ rc_t Initialize( int argc, char *argv[], struct ServerBase *Server ) /* Read the environment variables */ char* dummy = CONFDIR; if( dummy == NULL) - ErrorMsg( E_SYS, FAIL, "FAIL: Environment variable RMANHOME is not set!" ); + ErrorMsg( E_SYS, FAIL, "FAIL: configure error: CONFDIR not provided." ); Server->Directory = (char*)mymalloc(strlen(dummy) + 2); strcpy(Server->Directory, dummy); if( Server->Directory[strlen(Server->Directory)] != '/' ) diff --git a/include/globals.hh b/include/globals.hh index bfd0b28..47df1a8 100644 --- a/include/globals.hh +++ b/include/globals.hh @@ -49,9 +49,6 @@ rasdaman GmbH. /// default rasmgr listen port #define DEFAULT_PORT 7001 -/// name of env var pointing to rasdaman home dir (ex: "/opt/rasdaman") -#define RMANHOME_VAR "RMANHOME" - /// default name of server machine, if gethostname() fails #define DEFAULT_HOSTNAME "localhost" @@ -66,10 +63,6 @@ rasdaman GmbH. /// default password for this user #define DEFAULT_PASSWD "rasguest" -/// server log directory -#define LOGDIR "/log" -/// server alternative log directory, if RMANHOME not specified, defined via autoconf/automake -#define ALT_LOGDIR ABSOLUTE_LOG_DIR /// log file suffix #define LOG_SUFFIX "log" diff --git a/server/rasserver_config.cc b/server/rasserver_config.cc index 04745a3..1b5730d 100644 --- a/server/rasserver_config.cc +++ b/server/rasserver_config.cc @@ -20,11 +20,6 @@ rasdaman GmbH. * For more information please see <http://www.rasdaman.org> * or contact Peter Baumann via <baumann@rasdaman.com>. */ -/* - * 2003-nov-05 PB makeLogFileName: use constants, use /tmp if RMANHOME env var not defined - * 2005-sep-05 PB parseCommandLine(): exit -2 on help - * 2006-apr-21 PB added debug output - */ using namespace std; @@ -36,7 +31,7 @@ using namespace std; #include <sstream> #include "debug.hh" // ENTER, LEAVE, TALK -#include "globals.hh" // DEFAULT_PORT, LOGDIR, ALT_LOGDIR, LOG_SUFFIX +#include "globals.hh" // DEFAULT_PORT, LOGDIR, LOG_SUFFIX #include "rasserver_config.hh" #include "storagemgr/sstoragelayout.hh" @@ -106,7 +101,7 @@ void Configuration::initParameters() cmlOptLevel = &cmlInter.addLongParameter(NSN, "opt", "<nn> optimization level(0-4)\n\t\t 0 = no / 4 = maximal optimization", 4L); cmlConnectStr = &cmlInter.addStringParameter(NSN, "connect", "<connect-str> connect string for underlying database(e.g. test/test@julep)", "/"); - cmlLog = &cmlInter.addStringParameter('l', "log", "<log-file> log is printed to <log-file>\n\t\tif <log-file> is stdout , log output is printed to standard out", "$RMANHOME/log/<srv-name>.<pid>.log"); + cmlLog = &cmlInter.addStringParameter('l', "log", "<log-file> log is printed to <log-file>\n\t\tif <log-file> is stdout , log output is printed to standard out", string( CONFDIR ).append( "log/<srv-name>.<pid>.log").c_str() ); cmlTileSize = &cmlInter.addLongParameter(NSN, "tilesize", "<nnnn> specifies maximal size of tiles in bytes\n\t\t-regular tiles with equal edge lengthes", 2097152); cmlPctMin = &cmlInter.addLongParameter(NSN, "pctmin", "<nnnn> specifies minimal size of blobtiles in bytes", 2048); @@ -233,22 +228,16 @@ Configuration::initLogFiles() const char * Configuration::makeLogFileName(const char *srvName,const char *desExt) { - static char buffer[ FILENAME_MAX ]; + static char logfilePath[ FILENAME_MAX ]; int pid =getpid(); - char *dir = getenv( RMANHOME_VAR ); - if (dir == NULL) - { - cout << "Error: environment variable " << RMANHOME_VAR << " not set. Using " << ALT_LOGDIR << " for the moment being." << endl; - strcpy( buffer, ALT_LOGDIR ); - } - else + mkdir( LOGDIR, S_IRWXU + S_IRGRP+S_IXGRP + S_IROTH+S_IXOTH ); // create if not exist, rwxr-xr-x + int pathLen = snprintf( logfilePath, FILENAME_MAX, "%s/%s.%06d.%s", LOGDIR, srvName, pid, desExt ); + if (pathLen >= FILENAME_MAX) { - strcpy( buffer, dir ); - strcat( buffer, LOGDIR ); + logfilePath[FILENAME_MAX-1] = '\0'; // force-terminate string before printing + cerr << "Warning: path name longer than allowed by OS, likely log file cannot be written: " << logfilePath << endl; } - mkdir(buffer,S_IRWXU + S_IRGRP+S_IXGRP + S_IROTH+S_IXOTH); // create if not exist, rwxr-xr-x - sprintf(buffer+strlen(buffer),"/%s.%06d.%s",srvName,pid,desExt); - return buffer; + return logfilePath; } void |