Advertisement
ccrr10

ddclient service

Jan 18th, 2021
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.80 KB | None | 0 0
  1. #!/sbin/openrc-run
  2. description="ddclient Daemon for Alpine"
  3. command="/usr/sbin/ddclient"
  4. config_file="/etc/ddclient/ddclient.conf"
  5. command_args=""
  6. pidfile=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 pid= | awk -F '=' '{print $2}')
  7. delay=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 "daemon" | awk -F '=' '{print $2}')
  8.  
  9. if [ -z "${delay}" ]
  10. then
  11. command_args="-daemon 300"
  12. else
  13. command_args=""
  14. fi
  15.  
  16.  
  17. depend() {
  18. use logger
  19. need net
  20. after firewall
  21. }
  22.  
  23. start() {
  24. ebegin "Starting ddclient"
  25. start-stop-daemon --start \
  26. --exec "${command}" \
  27. --pidfile "${pidfile}" \
  28. -- \
  29. ${command_args}
  30. eend $?
  31. }
  32.  
  33. stop() {
  34. ebegin "Stopping ddclient"
  35. start-stop-daemon --stop --exec "${command}" \
  36. --pidfile "${pidfile}"
  37. eend $?
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement