Advertisement
Guest User

Service.sh for Sonarr on Drobo5N

a guest
Mar 18th, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. #!/usr/bin/env sh
  2. #
  3. # Service.sh for Sonarr
  4.  
  5. # import DroboApps framework functions
  6. . /etc/service.subr
  7.  
  8. framework_version="2.1"
  9. name="Sonarr"
  10. version="2.4.2"
  11. description="TV Downloader"
  12. depends=""
  13. webui=""
  14.  
  15. prog_dir="$(dirname "$(realpath "${0}")")"
  16. tmp_dir="/tmp/DroboApps/${name}"
  17. pidfile="${tmp_dir}/pid.txt"
  18. logfile="${tmp_dir}/log.txt"
  19. statusfile="${tmp_dir}/status.txt"
  20. errorfile="${tmp_dir}/error.txt"
  21.  
  22. # backwards compatibility
  23. if [ -z "${FRAMEWORK_VERSION:-}" ]; then
  24.   framework_version="2.0"
  25.   . "${prog_dir}/libexec/service.subr"
  26. fi
  27.  
  28. start() {
  29.   rm -f "${errorfile}"
  30.   echo "Sonarr is configured." > "${statusfile}"
  31.   touch "${pidfile}"
  32.   ../mono/bin/mono NzbDrone.exe
  33.   return 0
  34. }
  35.  
  36. is_running() {
  37.   [ -f "${pidfile}" ]
  38. }
  39.  
  40. stop() {
  41.   rm -f "${pidfile}"
  42.   return 0
  43. }
  44.  
  45. force_stop() {
  46.   rm -f "${pidfile}"
  47.   return 0
  48. }
  49.  
  50. # boilerplate
  51. if [ ! -d "${tmp_dir}" ]; then mkdir -p "${tmp_dir}"; fi
  52. exec 3>&1 4>&2 1>> "${logfile}" 2>&1
  53. STDOUT=">&3"
  54. STDERR=">&4"
  55. echo "$(date +"%Y-%m-%d %H-%M-%S"):" "${0}" "${@}"
  56. set -o errexit  # exit on uncaught error code
  57. set -o nounset  # exit on unset variable
  58. set -o xtrace   # enable script tracing
  59.  
  60. main "${@}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement