annotate debian/noffle-cronfetch @ 383:863270a06774 noffle

[svn] fixed output
author godisch
date Fri, 18 Apr 2003 20:52:16 +0100
parents 3b5b7f3fd71f
children fc3e4fc0a88d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
1 #!/bin/sh
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
2 # $Id: noffle-cronfetch 434 2003-02-14 13:54:32Z godisch $
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
3 #
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
4 # noffle script to fetch articles, run from cron
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
5
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
6 exec > /dev/null 2>&1
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
7
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
8 LOCKFILE=/var/lock/noffle/noffle-cronfetch.pid
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
9 NOFFLE=/usr/bin/noffle
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
10
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
11 . /etc/default/noffle
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
12
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
13 [ "$NOFFLE_FETCHMODE" = cron ] || exit 0
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
14
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
15 if [ -f "$LOCKFILE" ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
16 # check if pid still exists
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
17 if kill -0 `cat $LOCKFILE`; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
18 logger -i -p news.info -t noffle-cronfetch -- "previous instance still running"
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
19 exit 0
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
20 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
21 # false lock
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
22 logger -i -p news.warning -t noffle-cronfetch -- "removing stale lock $LOCKFILE"
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
23 rm -f $LOCKFILE
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
24 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
25
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
26 trap 'rm -f $LOCKFILE' 0 1 2 15
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
27
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
28 echo $$ > $LOCKFILE
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
29 $NOFFLE --fetch
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
30 rm -f $LOCKFILE
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
31
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
32 trap '' 0
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
33 exit 0