You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

start.sh 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. # Source our persisted env variables from container startup
  3. . /etc/deluge/environment-variables.sh
  4. # This script will be called with tun/tap device name as parameter 1, and local IP as parameter 4
  5. # See https://openvpn.net/index.php/open-source/documentation/manuals/65-openvpn-20x-manpage.html (--up cmd)
  6. echo "Up script executed with $*"
  7. if [ "$4" = "" ]; then
  8. echo "ERROR, unable to obtain tunnel address"
  9. echo "killing $PPID"
  10. kill -9 $PPID
  11. exit 1
  12. fi
  13. # If deluge-pre-start.sh exists, run it
  14. if [ -x /scripts/deluge-pre-start.sh ]
  15. then
  16. echo "Executing /scripts/deluge-pre-start.sh"
  17. /scripts/deluge-pre-start.sh
  18. echo "/scripts/deluge-pre-start.sh returned $?"
  19. fi
  20. echo "Updating DELUGE_BIND_ADDRESS_IPV4 to the ip of $1 : $4"
  21. export DELUGE_BIND_ADDRESS_IPV4=$4
  22. #echo "Generating transmission settings.json from env variables"
  23. ## Ensure DELUGE_HOME is created
  24. #mkdir -p ${DELUGE_HOME}
  25. dockerize -template /etc/deluge/settings.tmpl:${DELUGE_HOME}/settings.json
  26. #echo "sed'ing True to true"
  27. #sed -i 's/True/true/g' ${DELUGE_HOME}/settings.json
  28. #if [ ! -e "/dev/random" ]; then
  29. # # Avoid "Fatal: no entropy gathering module detected" error
  30. # echo "INFO: /dev/random not found - symlink to /dev/urandom"
  31. # ln -s /dev/urandom /dev/random
  32. #fi
  33. . /etc/deluge/userSetup.sh
  34. if [ "true" = "$DROP_DEFAULT_ROUTE" ]; then
  35. echo "DROPPING DEFAULT ROUTE"
  36. ip r del default || exit 1
  37. fi
  38. echo "STARTING DELUGED"
  39. exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "deluged -d -c /config -L info -l /data/deluged.log" &
  40. #exec su --preserve-environment abc -s /bin/bash -c "deluged -d -c /data -L info -l /data/deluged.log" &
  41. echo "STARTING DELUGE-WEB"
  42. exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "deluge-web -c /config" &
  43. #exec su --preserve-environment abc -s /bin/bash -c "deluge-web -c /data" &
  44. #if [ "$OPENVPN_PROVIDER" = "PIA" ]
  45. #then
  46. # echo "CONFIGURING PORT FORWARDING"
  47. # exec /etc/deluge/updatePort.sh &
  48. #else
  49. # echo "NO PORT UPDATER FOR THIS PROVIDER"
  50. #fi
  51. # If deluge-post-start.sh exists, run it
  52. if [ -x /scripts/deluge-post-start.sh ]
  53. then
  54. echo "Executing /scripts/deluge-post-start.sh"
  55. /scripts/deluge-post-start.sh
  56. echo "/scripts/deluge-post-start.sh returned $?"
  57. fi
  58. echo "Deluge startup script complete."