1
0

redsocks.init 638 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2007 OpenWrt.org
  3. START=90
  4. # check if configuration exists
  5. [ -e "/etc/redsocks.conf" ] || exit 0
  6. start() {
  7. if [ -e "/var/run/redsocks.pid" ]; then
  8. echo "redsocks is already running"
  9. exit 0
  10. fi
  11. /bin/echo -n "running redsocks ..."
  12. # startup the safety-wrapper for the daemon
  13. /usr/sbin/redsocks -p /var/run/redsocks.pid
  14. /bin/echo " done"
  15. }
  16. stop() {
  17. if [ ! -e "/var/run/redsocks.pid" ]; then
  18. echo "redsocks is not running"
  19. exit 0
  20. fi
  21. /bin/echo -n "stopping redsocks ..."
  22. # kill the process
  23. /bin/kill $(cat /var/run/redsocks.pid)
  24. rm /var/run/redsocks.pid
  25. echo " done"
  26. }