29 cout <<
"killmcs: kills a MCS server" << endl;
30 cout <<
"Giorgio Calderone <gcalderone@ifc.inaf.it>" << endl;
32 cout <<
"Usage: killmcs [-h] appname [inipath]" << endl;
36 int main(
int argc,
char* argv[])
53 string appname = cp.
arg(0).
sval();
56 string inipath = (cp.
argc() >= 2 ? cp.
arg(1).
sval() :
"");
59 env =
new Env(appname);
61 env =
new Env(appname, inipath);
64 if (chdir(env->
path.c_str()) != 0)
67 s = env->
path +
"/mcs.pid";
68 ifstream pidfile(
"mcs.pid");
71 throw MCS_ERROR(MSG_CANT_OPEN_FILE, s.c_str());
80 exit(system(s.c_str()));
83 cerr << e.
msg() << endl;
void parseCmd(string c)
Parse a command line into tokens, arguments and options.
string sval(bool addWhiteSpaces=false) const
Convert internal data to a string object.
Hold informations about an event.
string path
Main server path (APPD).
#define MCS_ERROR(A, rest...)
Facility to easily pass all necessary parameter to an Event constructor.
string msg()
Returns the message.
int argc()
Return number of arguments.
bool givenOpt(string opt)
Check if a certain option has been given.
Main include file for all MCS based applications.
Hold all environment variables.
Data & arg(int i)
Return argument at i-th position.
Namespace for MCS library.