X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=remotetop.git;a=blobdiff_plain;f=sendtop.c;fp=sendtop.c;h=297eabc52f8341b477278f36e2cad44b8fb39111;hp=8ab32692a462ff05b94e7260c90a9bc01f8a6121;hb=e3fdb3b9f9b62a71c2a11b5e27ee47214901a3e2;hpb=0db0da94f6e0d2809d5176cb408f40773d6073ca diff --git a/sendtop.c b/sendtop.c index 8ab3269..297eabc 100644 --- a/sendtop.c +++ b/sendtop.c @@ -116,6 +116,21 @@ sendTop(Msg *msg) { return TC_sendMsg(msg); } +void usage() { + fputs( + "Copyright (c) 2004-2007 Teodor Sigaev . All rights reserved.\n" + "sendtop - small daemon to send load of box to server\n" + "Usage:\n" + "./sendtop [-D] -h HOST [-p PORT] [-s PERIOD]\n" + " -D - debug mode (do not daemonize, print to stderr instead of syslog)\n" + " -h HOST - server IP to send data\n" + " -p PORT - port number of server\n" + " -s PERIOD - period of of send (in seconds)\n", + stdout + ); + + exit(1); +} extern char *optarg; int @@ -126,7 +141,7 @@ main( int argc, char *argv[] ) { int period=30; msg.port = TOPD_SERVER_DEFAULT_PORT; - msg.host = "127.0.0.1"; + msg.host = NULL; msg.msg = NULL; msg.sockfd =-1; @@ -145,10 +160,14 @@ main( int argc, char *argv[] ) { debug=1; break; default: + usage(); return 1; } } + if (!msg.host) + usage(); + signal(SIGCHLD, SIG_IGN); if ( debug )