19 |
|
virtual int Run(const app::ArgumentList& args) |
20 |
|
{ |
21 |
|
ext::String config("spectre.xml"), pid("spectre.pid"); |
22 |
– |
bool fork(false); |
22 |
|
|
23 |
|
_foreach (app::ArgumentList, arg, args) |
24 |
|
{ |
25 |
|
Matcher matcher; |
26 |
|
|
27 |
|
if (*arg == matcher("^-config=(.*)$")) config = matcher[1]; |
29 |
– |
else if (*arg == "-fork") fork = true; |
28 |
|
else if (*arg == matcher("^-pid=(.*)$")) pid = matcher[1]; |
29 |
|
else if (*arg == "-D") Spectre2::debug = true; |
30 |
|
else |
31 |
|
{ |
32 |
< |
api::Cerr << "Usage: " << Spectre2::program << " [-config=config] [-fork] [-pid=pid] [-D]" << ios::NewLine; |
32 |
> |
api::Cerr << "Usage: " << Spectre2::program << " [-config=config] [-pid=pid] [-D]" << ios::NewLine; |
33 |
|
|
34 |
|
return 1; |
35 |
|
} |
36 |
|
} |
37 |
|
|
40 |
– |
if (fork && api::Posix::CheckError(::fork())) return 0; |
41 |
– |
|
38 |
|
Spectre2(config, pid); |
39 |
|
|
40 |
|
return 0; |
69 |
|
action.sa_flags = SA_SIGINFO; |
70 |
|
|
71 |
|
api::Posix::CheckError(::sigemptyset(&action.sa_mask)); |
72 |
< |
api::Posix::CheckError(::sigaction(SIGHUP, &action, NULL)); |
72 |
> |
api::Posix::CheckError(::sigaction(SIGUSR1, &action, NULL)); |
73 |
|
|
74 |
|
action.sa_sigaction = stop; |
75 |
|
|
85 |
|
api::Posix::CheckError(::unlink(pid.NullTerminate())); |
86 |
|
} |
87 |
|
|
88 |
< |
ext::String Spectre2::program(api::GetExecutablePath().GetName()); |
88 |
> |
ext::String Spectre2::program(api::GetExecutablePath().GetName()), Spectre2::prefix(_Spectre2_prefix_), Spectre2::root(_Spectre2_root_); |
89 |
|
bool Spectre2::debug(false); |
90 |
|
ext::Vector<Daemon*> Spectre2::daemons; |
91 |
|
|