daily pastebin goal
68%
SHARE
TWEET

duplicati rc.d script

tiwie Jan 7th, 2019 58 in 20 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # $FreeBSD$
  4. #
  5.  
  6. # PROVIDE: duplicati
  7. # REQUIRE: LOGIN
  8. # KEYWORD: shutdown
  9.  
  10. # Add the following lines to /etc/rc.conf to enable duplicati:
  11. # duplicati_enable="YES"
  12. #
  13. # Optionaly there is some other parameters:
  14. # duplicati_user="duplicati"
  15. # duplicati_group="duplicati"
  16. # duplicati_data_dir="/config"
  17.  
  18. . /etc/rc.subr
  19.  
  20. name="duplicati"
  21. rcvar="${name}_enable"
  22.  
  23. load_rc_config $name
  24.  
  25. : ${duplicati_enable="NO"}
  26. : ${duplicati_user:="duplicati"}
  27. : ${duplicati_group:="duplicati"}
  28. : ${duplicati_data_dir:="/config"}
  29.  
  30. duplicati_command_args="--webservice-port=8200 --webservice-interface=any --server-datafolder=${duplicati_data_dir}"
  31. duplicati_command="/usr/local/share/${name}/Duplicati.Server.exe ${duplicati_command_args}"
  32. pidfile="${duplicati_data_dir}/${name}.pid"
  33. procname="/usr/local/bin/mono"
  34. command="/usr/sbin/daemon"
  35. command_args="-f -p ${pidfile} ${procname} ${duplicati_command}"
  36. start_precmd=duplicati_precmd
  37.  
  38. duplicati_precmd() {
  39.         export XDG_CONFIG_HOME=${duplicati_data_dir}
  40.  
  41.         # avoid root user warning
  42.         export USER=${duplicati_user}
  43.  
  44.         if [ ! -d ${duplicati_data_dir} ]; then
  45.                 install -d -o ${duplicati_user} ${duplicati_data_dir}
  46.         fi
  47. }
  48.  
  49. run_rc_command "$1"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top