#!/bin/sh
# log_shipper - tail /dump/*.log and push them to Loki (see shipper/README.md).
# Config comes from the environment; defaults in the binary match the machine.

case "$1" in
  start)
    start-stop-daemon -S -b -m -p /run/logshipper.pid -x /usr/local/bin/logshipper
    ;;
  stop)
    start-stop-daemon -K -p /run/logshipper.pid
    ;;
  restart)
    "$0" stop
    sleep 1
    "$0" start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
    exit 1
    ;;
esac
