Skip to content

Commit

Permalink
make it only run once
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew authored and afresh1 committed Sep 3, 2012
1 parent 4e055dc commit 7ffdc04
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions regen.sh
Expand Up @@ -4,6 +4,17 @@
. /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 $*
Expand Down

0 comments on commit 7ffdc04

Please sign in to comment.