aboutsummaryrefslogtreecommitdiffstats
path: root/cron-sh/security.sh
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2002-03-06 04:11:58 +0000
committerFrederic Lepied <flepied@mandriva.com>2002-03-06 04:11:58 +0000
commit504ab3efd8740ac442c4aed462bca175ae28c8fb (patch)
tree38fb61946c8f79825da1be19bc062ca70a7c2d08 /cron-sh/security.sh
parent40a29faeeeeafc983028f51e6c17c64117e301c3 (diff)
downloadmsec-504ab3efd8740ac442c4aed462bca175ae28c8fb.tar
msec-504ab3efd8740ac442c4aed462bca175ae28c8fb.tar.gz
msec-504ab3efd8740ac442c4aed462bca175ae28c8fb.tar.bz2
msec-504ab3efd8740ac442c4aed462bca175ae28c8fb.tar.xz
msec-504ab3efd8740ac442c4aed462bca175ae28c8fb.zip
don't run twice
Diffstat (limited to 'cron-sh/security.sh')
-rwxr-xr-xcron-sh/security.sh23
1 files changed, 18 insertions, 5 deletions
diff --git a/cron-sh/security.sh b/cron-sh/security.sh
index 1c2dfec..f0b6124 100755
--- a/cron-sh/security.sh
+++ b/cron-sh/security.sh
@@ -1,5 +1,23 @@
#!/bin/bash
+LCK=/var/run/msec-security.pid
+
+function cleanup() {
+ rm -f $LCK
+}
+
+if [ -f $LCK ]; then
+ if [ -d /proc/`cat $LCK` ]; then
+ exit 0
+ else
+ rm -f $LCK
+ fi
+fi
+
+echo -n $$ > $LCK
+
+trap cleanup 0
+
if [[ ! -f /var/lib/msec/security.conf ]]; then
echo "Can't access /var/lib/msec/security.conf."
exit 1
@@ -148,11 +166,6 @@ fi
### rpm database check
if [[ ${RPM_CHECK} == yes ]]; then
- if [ -f /var/lib/rpm/__db.001 -o -f /var/lib/rpm/__db.002 ]; then
- rm -f /var/lib/rpm/__db.00*
- rpm --rebuilddb
- fi
-
rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}\t%{INSTALLTIME}\n" | sort > ${RPM_QA_TODAY}
rm -f ${RPM_VA_TODAY}.tmp