Annotation of openbsd/OpenBSDTorrents/regen.sh, Revision 1.7
1.1 andrew 1: #!/bin/sh
1.7 ! andrew 2: #$Id: regen.sh,v 1.6 2005/05/02 21:49:21 andrew Exp andrew $
1.1 andrew 3:
1.5 andrew 4: . /etc/OpenBSDTorrents.conf
1.3 andrew 5:
1.5 andrew 6: cd ${OBT_DIR_HOME}
1.6 andrew 7: PIDFILE=${OBT_DIR_HOME}/run/regen.pid
8:
9: if [ -e ${PIDFILE} ]; then
10: PID=`head -1 ${PIDFILE}`
11: kill -0 ${PID} 2> /dev/null
12: if [ $? -eq 0 ]; then
13: echo Already running
14: exit 1
15: fi
16: fi
17: echo $$ > ${PIDFILE}
1.3 andrew 18:
19: if [[ $1 != skip ]]; then
1.5 andrew 20: echo ${OBT_DIR_HOME}/MakeTorrents.pl $*
21: ${OBT_DIR_HOME}/MakeTorrents.pl $*
1.3 andrew 22: fi
23:
1.5 andrew 24: echo ${OBT_DIR_HOME}/CurrentTorrents.pl
25: ${OBT_DIR_HOME}/CurrentTorrents.pl
1.3 andrew 26:
1.7 ! andrew 27: #if [ $? != 253 ]; then exit; fi
1.3 andrew 28:
1.7 ! andrew 29: echo Removing old torrents
! 30: for f in `ls ${OBT_DIR_CUR_TORRENT}`; do
! 31: if [ ! -e ${OBT_DIR_TORRENT}/$f ]; then
! 32: rm ${OBT_DIR_CUR_TORRENT}/$f
! 33: fi
! 34: done
! 35:
! 36: echo ${OBT_DIR_HOME}/ServerTorrents.pl
! 37: ${OBT_DIR_HOME}/ServerTorrents.pl
! 38:
! 39: echo lftp -f ${OBT_DIR_HOME}/lftp.script
! 40: lftp -f ${OBT_DIR_HOME}/lftp.script
! 41:
! 42: sleep 60;
! 43:
! 44: echo Starting new torrents
! 45: for f in `ls ${OBT_DIR_TORRENT}`; do
! 46: if [ ! -e ${OBT_DIR_CUR_TORRENT}/$f ]; then
! 47: ln -s ${OBT_DIR_TORRENT}/$f ${OBT_DIR_CUR_TORRENT}/$f
! 48: fi
! 49: done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>