return TC_sendMsg(msg);
}
+void usage() {
+ fputs(
+ "Copyright (c) 2004-2007 Teodor Sigaev <teodor@sigaev.ru>. 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
int period=30;
msg.port = TOPD_SERVER_DEFAULT_PORT;
- msg.host = "127.0.0.1";
+ msg.host = NULL;
msg.msg = NULL;
msg.sockfd =-1;
debug=1;
break;
default:
+ usage();
return 1;
}
}
+ if (!msg.host)
+ usage();
+
signal(SIGCHLD, SIG_IGN);
if ( debug )