added per-override run feature

This commit is contained in:
Evgeniy Kozhuhovskiy
2005-10-24 14:04:37 +00:00
parent e55de5023e
commit 40556b610a
8 changed files with 44 additions and 11 deletions
+7
View File
@@ -375,6 +375,13 @@ static int proc_override(s_override *dest, char *value)
(*p)->sIpaddr = xstrcpy(arg);
key = NULL;
}
else if( strcasecmp(key, "run") == 0)
{
if( (*p)->run )
free((*p)->run);
(*p)->run = xstrcpy(arg);
key = NULL;
}
else if( strcasecmp(key, "worktime") == 0 )
{
if( timevec_parse_list(&((*p)->worktime), arg) == -1 )
+9 -1
View File
@@ -538,7 +538,8 @@ int call_system_tcpip(void)
int call_system(s_faddr addr, const s_bforce_opts *opts)
{
int rc = 0;
int rc = 0;
int runrc = 0;
char abuf[BF_MAXADDRSTR+1];
char *p_lockdir = NULL;
char *errmsg = NULL;
@@ -668,6 +669,13 @@ do_session:
errmsg = "cannot lock address";
gotoexit(BFERR_SYSTEM_LOCKED);
}
if( strlen(state.override.run) > 0 )
{
if ( (runrc = system(state.override.run) != 0 ))
{
logerr("run script \"%s\" executed with non-zero return value", state.override.run);
}
}
setproctitle("bforce calling %.32s, %.32s",
ftn_addrstr(abuf, state.node.addr), state.node.phone);