diff debian/noffle-cronfetch @ 301:3b5b7f3fd71f noffle

[svn] initial debian/ upload
author godisch
date Fri, 14 Feb 2003 13:54:32 +0000
parents
children fc3e4fc0a88d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/noffle-cronfetch	Fri Feb 14 13:54:32 2003 +0000
@@ -0,0 +1,33 @@
+#!/bin/sh
+# $Id: noffle-cronfetch 434 2003-02-14 13:54:32Z godisch $
+#
+# noffle script to fetch articles, run from cron
+
+exec > /dev/null 2>&1
+
+LOCKFILE=/var/lock/noffle/noffle-cronfetch.pid
+NOFFLE=/usr/bin/noffle
+
+. /etc/default/noffle
+
+[ "$NOFFLE_FETCHMODE" = cron ] || exit 0
+
+if [ -f "$LOCKFILE" ]; then
+    # check if pid still exists
+    if kill -0 `cat $LOCKFILE`; then
+        logger -i -p news.info -t noffle-cronfetch -- "previous instance still running"
+        exit 0
+    fi
+    # false lock
+    logger -i -p news.warning -t noffle-cronfetch -- "removing stale lock $LOCKFILE"
+    rm -f $LOCKFILE
+fi
+
+trap 'rm -f $LOCKFILE' 0 1 2 15
+
+echo $$ > $LOCKFILE
+$NOFFLE --fetch 
+rm -f $LOCKFILE
+
+trap '' 0
+exit 0