Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
7ca75402
Commit
7ca75402
authored
Apr 12, 2015
by
Axel Auweter
Browse files
Fix #32 (CollectAgent should support running as daemon)
parent
1dacb529
Changes
1
Hide whitespace changes
Inline
Side-by-side
CollectAgent/collectagent.cpp
View file @
7ca75402
...
...
@@ -122,11 +122,12 @@ void mqttCallback(SimpleMQTTMessage *msg)
* Print usage information
*/
void
usage
()
{
printf
(
"Usage: collectagent [-l <host>] [-h <host>]
\n
"
);
printf
(
"Usage: collectagent
[-D]
[-l <host>] [-h <host>]
\n
"
);
printf
(
"Collectagent will accept remote connections by listening to the
\n
"
);
printf
(
"specified listen address (-l <host>) at port 1883 (default MQTT port).
\n
"
);
printf
(
"It will also connect to cassandra to the specifiec addres (-h <host>).
\n
"
);
printf
(
"The default <host> is localhost/127.0.0.1.
\n\n
"
);
printf
(
"The default <host> is localhost/127.0.0.1.
\n
"
);
printf
(
"If the -D option is specified, CollectAgent will run as daemon.
\n\n
"
);
}
int
main
(
int
argc
,
char
*
const
argv
[])
{
...
...
@@ -148,7 +149,7 @@ int main(int argc, char* const argv[]) {
int
ret
;
listenHost
=
"localhost"
;
cassandraHost
=
"127.0.0.1"
;
while
((
ret
=
getopt
(
argc
,
argv
,
"h:?"
))
!=-
1
)
{
while
((
ret
=
getopt
(
argc
,
argv
,
"h:
l:D
?"
))
!=-
1
)
{
switch
(
ret
)
{
case
'h'
:
cassandraHost
=
optarg
;
...
...
@@ -156,6 +157,9 @@ int main(int argc, char* const argv[]) {
case
'l'
:
listenHost
=
optarg
;
break
;
case
'D'
:
daemon
(
1
,
1
);
break
;
case
'?'
:
default:
usage
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment