Merge lp:~jpds/ubumirror/debian-style-locking into lp:ubumirror

Proposed by Jonathan Davies
Status: Merged
Approved by: Nafallo Bjälevik
Approved revision: 29
Merged at revision: 29
Proposed branch: lp:~jpds/ubumirror/debian-style-locking
Merge into: lp:ubumirror
Diff against target: None lines
To merge this branch: bzr merge lp:~jpds/ubumirror/debian-style-locking
Reviewer Review Type Date Requested Status
Nafallo Bjälevik Approve
Review via email: mp+5477@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Nafallo Bjälevik (nafallo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2009-04-11 20:57:29 +0000
3+++ debian/control 2009-04-12 22:39:03 +0000
4@@ -9,7 +9,7 @@
5
6 Package: ubumirror
7 Architecture: all
8-Depends: cron, debianutils, jigit, procmail, rsync
9+Depends: cron, debianutils, jigit, rsync
10 Recommends: postfix | mail-transport-agent, apache2 | httpd
11 Suggests: vsftpd | proftpd
12 Description: Ubuntu mirror scripts
13
14=== modified file 'ubuarchive'
15--- ubuarchive 2009-04-12 20:41:51 +0000
16+++ ubuarchive 2009-04-12 22:39:03 +0000
17@@ -35,10 +35,16 @@
18 umask 022
19
20 # Check to see if another sync is in progress
21-if lockfile -! -l 43200 -r 0 "$LOCK"; then
22- echo ${HOSTNAME} is unable to start rsync, lock file exists
23- exit 1
24+if ! ( set -o noclobber; echo "$$" > "${LOCK}") 2> /dev/null; then
25+ if ! $(kill -0 $(cat ${LOCK}) 2>/dev/null); then
26+ # Process does either not exist or is not owned by us.
27+ echo "$$" > "${LOCK}"
28+ else
29+ echo "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})."
30+ exit 1
31+ fi
32 fi
33+
34 trap 'rm -f $LOCK > /dev/null 2>&1; echo -n "Done at " >> $LOGDIR/ubuarchive.log; date >> $LOGDIR/ubuarchive.log; savelog -n $LOGDIR/ubuarchive.log > /dev/null' EXIT
35
36 echo -n "Starting at " > $LOGDIR/ubuarchive.log
37
38=== modified file 'ubucdimage'
39--- ubucdimage 2009-04-12 20:41:51 +0000
40+++ ubucdimage 2009-04-12 22:39:03 +0000
41@@ -38,10 +38,16 @@
42 umask 022
43
44 # Check to see if another sync is in progress
45-if lockfile -! -l 43200 -r 0 "$LOCK"; then
46- echo $HOSTNAME is unable to start rsync, lock file exists
47- exit 1
48+if ! ( set -o noclobber; echo "$$" > "${LOCK}") 2> /dev/null; then
49+ if ! $(kill -0 $(cat ${LOCK}) 2>/dev/null); then
50+ # Process does either not exist or is not owned by us.
51+ echo "$$" > "${LOCK}"
52+ else
53+ echo "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})."
54+ exit 1
55+ fi
56 fi
57+
58 trap 'rm -f $LOCK > /dev/null 2>&1; echo -n "Done at " >> $LOGDIR/ubucdimage.log; date >> $LOGDIR/ubucdimage.log; savelog -n $LOGDIR/ubucdimage.log > /dev/null' EXIT
59
60 echo -n "Starting at " >> $LOGDIR/ubucdimage.log
61
62=== modified file 'ubudvd'
63--- ubudvd 2009-04-12 20:41:51 +0000
64+++ ubudvd 2009-04-12 22:39:03 +0000
65@@ -35,10 +35,16 @@
66 umask 022
67
68 # Check to see if another sync is in progress
69-if lockfile -! -l 43200 -r 0 "$LOCK"; then
70- echo $HOSTNAME is unable to start rsync, lock file exists
71- exit 1
72+if ! ( set -o noclobber; echo "$$" > "${LOCK}") 2> /dev/null; then
73+ if ! $(kill -0 $(cat ${LOCK}) 2>/dev/null); then
74+ # Process does either not exist or is not owned by us.
75+ echo "$$" > "${LOCK}"
76+ else
77+ echo "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})."
78+ exit 1
79+ fi
80 fi
81+
82 trap 'rm -f $LOCK > /dev/null 2>&1; echo -n "Done at " >> $LOGDIR/ubudvd.log; date >> $LOGDIR/ubudvd.log; savelog -n $LOGDIR/ubudvd.log > /dev/null' EXIT
83
84 echo -n "Starting at " >> $LOGDIR/ubudvd.log
85
86=== modified file 'uburelease'
87--- uburelease 2009-04-12 20:41:51 +0000
88+++ uburelease 2009-04-12 22:39:03 +0000
89@@ -35,10 +35,16 @@
90 umask 022
91
92 # Check to see if another sync is in progress
93-if lockfile -! -l 43200 -r 0 "$LOCK"; then
94- echo $HOSTNAME is unable to start rsync, lock file exists
95- exit 1
96+if ! ( set -o noclobber; echo "$$" > "${LOCK}") 2> /dev/null; then
97+ if ! $(kill -0 $(cat ${LOCK}) 2>/dev/null); then
98+ # Process does either not exist or is not owned by us.
99+ echo "$$" > "${LOCK}"
100+ else
101+ echo "Unable to start rsync, lock file still exists, PID $(cat ${LOCK})."
102+ exit 1
103+ fi
104 fi
105+
106 trap 'rm -f $LOCK > /dev/null 2>&1; echo -n "Done at " >> $LOGDIR/uburelease.log; date >> $LOGDIR/uburelease.log; savelog -n $LOGDIR/uburelease.log > /dev/null' EXIT
107
108 echo -n "Starting at " >> $LOGDIR/uburelease.log

Subscribers

People subscribed via source and target branches

to status/vote changes: