#!/bin/bash
# Flexget daemon autostart

description "Flexget daemon"
author "roll.urown.net"

#start on (filesystem and networking) or runlevel [2345]
start on started transmission-daemon
#stop on runlevel [016]
stop on stopping transmission-daemon

respawn
respawn limit 5 30

#
# to find your local run the locale command an example local would be en_US.utf8
env LANG="en_US.UTF-8"
env UID="debian-transmission"
env GID="debian-transmission"
#
# log levels none, critical,error, warning, info, verbose, debug, trace
env LOGLVL="warning"
env CFGDIR="/var/lib/transmission-daemon/flexget"
export CFGFILE="${CFGDIR}/config.yml"

exec start-stop-daemon -S -c $UID:$GID --chdir $CFGDIR -x \
    /usr/local/bin/flexget -- --loglevel $LOGLVL daemon start
