${0} start
;;
+ reload-or-restart)
+ # Reload the process if it is already running. Otherwise, restart.
+ if pidofproc -s /usr/bin/tor; then
+ $0 reload
+ else
+ $0 restart
+ fi
+ ;;
+
status)
statusproc /usr/bin/tor
;;
*)
- echo "Usage: ${0} {start|stop|reload|restart|status}"
+ echo "Usage: ${0} {start|stop|reload|restart|reload-or-restart|status}"
exit 1
;;
esac
redctrl syslogdctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
smartctrl clamavctrl addonctrl pakfire mpfirectrl wlanapctrl \
setaliases urlfilterctrl updxlratorctrl fireinfoctrl rebuildroutes \
- getconntracktable wirelessclient dnsmasqctrl
+ getconntracktable wirelessclient dnsmasqctrl torctrl
SUID_UPDX = updxsetperms
install : all
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
+ $(COMPILE) -I../install+setup/libsmooth/ torctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
--- /dev/null
+/* 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include "setuid.h"
+
+int main(int argc, char *argv[]) {
+ if (!(initsetuid()))
+ exit(1);
+
+ if (argc < 2) {
+ fprintf(stderr, "\nNo argument given.\n\ntorctrl (restart)\n\n");
+ exit(1);
+ }
+
+ if (strcmp(argv[1], "restart") == 0) {
+ safe_system("/etc/rc.d/init.d/tor reload-or-restart");
+ } else {
+ fprintf(stderr, "\nBad argument given.\n\ntorctrl (restart)\n\n");
+ exit(1);
+ }
+
+ return 0;
+}