]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/misc-progs/qosctrl.c
1 /* This file is part of the IPFire Firewall.
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
12 #include <sys/types.h>
16 #define QOS_SH "/var/ipfire/qos/bin/qos.sh"
18 int main(int argc
, char *argv
[]) {
26 fprintf(stderr
, "\nNo argument given.\n\nqosctrl (start|stop|restart|status|generate)\n\n");
30 if (strcmp(argv
[1], "generate") == 0) {
31 safe_system("/usr/bin/perl /var/ipfire/qos/bin/makeqosscripts.pl > " QOS_SH
);
34 if ((fd
= open(QOS_SH
, O_RDONLY
)) != -1) {
37 // If there is no qos.sh do nothing.
41 safe_system("chmod 755 " QOS_SH
" &>/dev/null");
42 if (strcmp(argv
[1], "start") == 0) {
43 safe_system(QOS_SH
" start");
44 } else if (strcmp(argv
[1], "stop") == 0) {
45 safe_system(QOS_SH
" clear");
46 } else if (strcmp(argv
[1], "status") == 0) {
47 safe_system(QOS_SH
" status");
48 } else if (strcmp(argv
[1], "restart") == 0) {
49 safe_system(QOS_SH
" restart");
51 if (strcmp(argv
[1], "generate") == 0) {exit(0);}
52 fprintf(stderr
, "\nBad argument given.\n\nqosctrl (start|stop|restart|status|generate)\n\n");