From: Alexander Marx Date: Tue, 7 Apr 2015 13:35:31 +0000 (+0200) Subject: vpn-statistic: create collectd wrapper to restart collectd when first vpn was created X-Git-Tag: v2.17-core89~3^2~15 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=91c2eaec9a4528d9c94ae18bf1ac12077faa1f07 vpn-statistic: create collectd wrapper to restart collectd when first vpn was created This wrapper is only used, when the first openvpn RW is created. Then the collectd has to be restarted to get the vpn Data and create rrd Data --- diff --git a/config/rootfiles/common/misc-progs b/config/rootfiles/common/misc-progs index 1ab4dec5f1..f33d08c61a 100644 --- a/config/rootfiles/common/misc-progs +++ b/config/rootfiles/common/misc-progs @@ -2,6 +2,7 @@ usr/local/bin/addonctrl #usr/local/bin/applejuicectrl usr/local/bin/backupctrl #usr/local/bin/clamavctrl +usr/local/bin/collectdctrl usr/local/bin/dhcpctrl usr/local/bin/dnsmasqctrl usr/local/bin/extrahdctrl diff --git a/config/rootfiles/core/89/filelists/files b/config/rootfiles/core/89/filelists/files index f344208d59..c35b885dad 100644 --- a/config/rootfiles/core/89/filelists/files +++ b/config/rootfiles/core/89/filelists/files @@ -11,6 +11,7 @@ srv/web/ipfire/cgi-bin/netovpnrw.cgi srv/web/ipfire/cgi-bin/netovpnsrv.cgi srv/web/ipfire/cgi-bin/ovpnmain.cgi srv/web/ipfire/cgi-bin/vpnmain.cgi +usr/local/bin/collectdctrl usr/local/bin/openvpnctrl var/ipfire/backup/bin/backup.pl var/ipfire/graphs.pl diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile index f5802d26ac..43e6a9081e 100644 --- a/src/misc-progs/Makefile +++ b/src/misc-progs/Makefile @@ -25,7 +25,7 @@ LIBS = -lsmooth -lnewt PROGS = iowrap SUID_PROGS = squidctrl sshctrl ipfirereboot \ ipsecctrl timectrl dhcpctrl snortctrl \ - applejuicectrl rebuildhosts backupctrl \ + applejuicectrl rebuildhosts backupctrl collectdctrl \ logwatch openvpnctrl firewallctrl \ wirelessctrl getipstat qosctrl launch-ether-wake \ redctrl syslogdctrl extrahdctrl sambactrl upnpctrl tripwirectrl \ diff --git a/src/misc-progs/collectdctrl.c b/src/misc-progs/collectdctrl.c new file mode 100644 index 0000000000..86e4b2a99b --- /dev/null +++ b/src/misc-progs/collectdctrl.c @@ -0,0 +1,39 @@ +/* This file is part of the IPFire Firewall. + * + * This program is distributed under the terms of the GNU General Public + * Licence. See the file COPYING for details. + * + */ + +#include +#include +#include +#include +#include +#include "setuid.h" + +int main(int argc, char *argv[]) { + if (!(initsetuid())) + exit(1); + + if (argc < 2) { + fprintf(stderr, "\nNo argument given.\n\ncollectdctrl (start|stop|restart)\n\n"); + exit(1); + } + + if (strcmp(argv[1], "restart") == 0) { + safe_system("/etc/rc.d/init.d/collectd restart"); + + } else if (strcmp(argv[1], "stop") == 0) { + safe_system("/etc/rc.d/init.d/collectd stop"); + + } else if (strcmp(argv[1], "start") == 0) { + safe_system("/etc/rc.d/init.d/collectd start"); + + } else { + fprintf(stderr, "\nBad argument given.\n\ncollectdctrl (start|stop|restart)\n\n"); + exit(1); + } + + return 0; +}