added per-override run feature
This commit is contained in:
@@ -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 )
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user