Return to regen.sh CVS log | Up to [local] / openbsd / OpenBSDTorrents |
File: [local] / openbsd / OpenBSDTorrents / regen.sh (download)
Revision 1.7, Wed Jun 1 18:19:06 2005 UTC (19 years, 1 month ago) by andrew
put the torrents we actually download someplace else, and that way we can remove the old ones before we get rid of them, and install the new ones after we make sure they are on the server. |
#!/bin/sh #$Id: regen.sh,v 1.7 2005/06/01 18:19:06 andrew Exp $ . /etc/OpenBSDTorrents.conf cd ${OBT_DIR_HOME} PIDFILE=${OBT_DIR_HOME}/run/regen.pid if [ -e ${PIDFILE} ]; then PID=`head -1 ${PIDFILE}` kill -0 ${PID} 2> /dev/null if [ $? -eq 0 ]; then echo Already running exit 1 fi fi echo $$ > ${PIDFILE} if [[ $1 != skip ]]; then echo ${OBT_DIR_HOME}/MakeTorrents.pl $* ${OBT_DIR_HOME}/MakeTorrents.pl $* fi echo ${OBT_DIR_HOME}/CurrentTorrents.pl ${OBT_DIR_HOME}/CurrentTorrents.pl #if [ $? != 253 ]; then exit; fi echo Removing old torrents for f in `ls ${OBT_DIR_CUR_TORRENT}`; do if [ ! -e ${OBT_DIR_TORRENT}/$f ]; then rm ${OBT_DIR_CUR_TORRENT}/$f fi done echo ${OBT_DIR_HOME}/ServerTorrents.pl ${OBT_DIR_HOME}/ServerTorrents.pl echo lftp -f ${OBT_DIR_HOME}/lftp.script lftp -f ${OBT_DIR_HOME}/lftp.script sleep 60; echo Starting new torrents for f in `ls ${OBT_DIR_TORRENT}`; do if [ ! -e ${OBT_DIR_CUR_TORRENT}/$f ]; then ln -s ${OBT_DIR_TORRENT}/$f ${OBT_DIR_CUR_TORRENT}/$f fi done