promtail.rc 872 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # Start script for FreeBSD, contributed by user Fabian Abplanalp
  3. # Put this script in /usr/local/etc/rc.d then adjust PROMTAIL_BIN and
  4. # PROMTAIL_CFG values in /etc/defaults/promtail
  5. PROMTAIL_BIN="/usr/local/bin/promtail"
  6. PROMTAIL_CFG="/usr/local/etc/promtail.config.yml"
  7. PROMTAIL_PID="/var/run/promtail.pid"
  8. # Read configuration variable file if it is present
  9. [ -r /etc/defaults/promtail ] && . /etc/defaults/promtail
  10. case "$1" in
  11. "start")
  12. echo "Starting promtail..."
  13. ${PROMTAIL_BIN} --config ${PROMTAIL_CFG} --daemon &
  14. echo $! >${PROMTAIL_PID}
  15. echo "done"
  16. ;;
  17. "stop")
  18. echo "Stopping promtail..."
  19. if [ -f ${PROMTAIL_PID} ]; then
  20. kill $(cat ${PROMTAIL_PID})
  21. rm ${PROMTAIL_PID}
  22. echo "done"
  23. else
  24. echo "not running?"
  25. fi
  26. ;;
  27. "restart")
  28. echo "Restarting promtail..."
  29. $0 stop
  30. sleep 2
  31. $0 start
  32. ;;
  33. *)
  34. echo "$0 [start|stop|restart]"
  35. ;;
  36. esac