summaryrefslogtreecommitdiffstats
path: root/abs/extra-testing/community/transmission-cli/run
blob: 6bcab3600567c3f09d663b9040a4241a600a3c3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/transmissiond

CONFIGDIR=/home/$TRANS_USER/.config/transmission-daemon
PID=`pidof -o %PPID /usr/bin/transmission-daemon`
# Update the block lists - try to keep the bad guys out.
          cd ${CONFIGDIR}/blocklists
          if [ $? -eq 0 ]; then
             find . -mtime +4 -type f -name level1 -exec rm {} \;
             if [ ! -f ${CONFIGDIR}/blocklists/level1 ]; then
                # update blocklist
               # echo "updating blocklist, ~4MB"
                wget -q -O level1.gz http://download.m0k.org/transmission/files/level1.gz
                if [ -f level1.gz ]; then
                  gunzip level1.gz
                  if [ $? -eq 0 ]; then
                    chmod go+r level1
                  else
                    rm -f level1*
                  fi
                fi
             fi
             cd - 2>&1 >/dev/null
          fi
    stat_runit "Starting Transmission Daemon"
    [ -z "$PID" ] && su -l -c "/usr/bin/nice -n 19 /usr/bin/transmission-daemon $TRANS_OPTS" $TRANS_USER 2>/dev/null
    if [ $? -ne 0 ]; then
      stat_fail
    else
      add_daemon transmissiond
      stat_done
    fi