annotate debian/noffle-cronfetch @ 499:1c4d3397e99f noffle

More items for .hgignore.
author Jim Hague <jim.hague@acm.org>
date Wed, 14 Aug 2013 11:50:21 +0100
parents fc3e4fc0a88d
children
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
442
fc3e4fc0a88d [svn] update
godisch
parents: 301
diff changeset
2 # $Id: noffle-cronfetch 585 2003-06-25 15:34:53Z godisch $
301
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
442
fc3e4fc0a88d [svn] update
godisch
parents: 301
diff changeset
17 if kill -0 `cat "$LOCKFILE"`; then
301
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"
442
fc3e4fc0a88d [svn] update
godisch
parents: 301
diff changeset
23 rm -f "$LOCKFILE"
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
24 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
25
442
fc3e4fc0a88d [svn] update
godisch
parents: 301
diff changeset
26 trap 'rm -f "$LOCKFILE"' 0 1 2 15
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
27
442
fc3e4fc0a88d [svn] update
godisch
parents: 301
diff changeset
28 echo "$$" > "$LOCKFILE"
fc3e4fc0a88d [svn] update
godisch
parents: 301
diff changeset
29 "$NOFFLE" --fetch
fc3e4fc0a88d [svn] update
godisch
parents: 301
diff changeset
30 rm -f "$LOCKFILE"
301
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