torctrl: Add stop action.

This commit is contained in:
Michael Tremer
2013-07-31 12:55:08 +02:00
parent c60301c06a
commit 9e7591e725
2 changed files with 7 additions and 3 deletions

View File

@@ -165,5 +165,5 @@ wirelessclient: wirelessclient.c setuid.o ../install+setup/libsmooth/varval.o
dnsmasqctrl: dnsmasqctrl.c setuid.o ../install+setup/libsmooth/varval.o
$(COMPILE) -I../install+setup/libsmooth/ dnsmasqctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
torctrl: toctrl.c setuid.o ../install+setup/libsmooth/varval.o
torctrl: torctrl.c setuid.o ../install+setup/libsmooth/varval.o
$(COMPILE) -I../install+setup/libsmooth/ torctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@

View File

@@ -17,14 +17,18 @@ int main(int argc, char *argv[]) {
exit(1);
if (argc < 2) {
fprintf(stderr, "\nNo argument given.\n\ntorctrl (restart)\n\n");
fprintf(stderr, "\nNo argument given.\n\ntorctrl (restart|stop)\n\n");
exit(1);
}
if (strcmp(argv[1], "restart") == 0) {
safe_system("/etc/rc.d/init.d/tor reload-or-restart");
} else if (strcmp(argv[1], "stop") == 0) {
safe_system("/etc/rc.d/init.d/tor stop");
} else {
fprintf(stderr, "\nBad argument given.\n\ntorctrl (restart)\n\n");
fprintf(stderr, "\nBad argument given.\n\ntorctrl (restart|stop)\n\n");
exit(1);
}