X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pl_mom.spec;h=94d41b470bea6ad198047084bf295050a5cf7c85;hb=5c5baf98f55b307cf781af6cbf8b546e99df28cc;hp=44ea666f4573a991be3d8a65d97d4424ef50e67a;hpb=e35960f004a9666f7f36582ef70307ceeb880d7a;p=mom.git diff --git a/pl_mom.spec b/pl_mom.spec index 44ea666..94d41b4 100644 --- a/pl_mom.spec +++ b/pl_mom.spec @@ -1,19 +1,20 @@ %define name pl_mom -%define version 0.2 -%define release 16.planetlab%{?date:.%{date}} +%define version 0.3 +%define release 13%{?pldistro:.%{pldistro}}%{?date:.%{date}} Summary: PlanetLab mom -- Cleans up your mess Name: %{name} Version: %{version} Release: %{release} -Copyright: dontknow +License: dontknow Group: System Environment/Kernel Source: %{name}-%{version}.tgz Vendor: PlanetLab Packager: PlanetLab Central -Distribution: PlanetLab 2.0 -URL: http://www.planet-lab.org +Distribution: PlanetLab 3.0 +URL: http://cvs.planet-lab.org/cvs/pl_mom BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Requires: expect %description @@ -21,6 +22,9 @@ A small daemon that watches the consumed swap space. At 90% utilization, it resets the slice that is the biggest memory hog. At 95% utilization, it reboots the machine. +A cron job which "fixes" various common problems with nodes (dead +services, ext3 corruption, zombie SSH sessions) is also installed. + %prep %setup @@ -33,6 +37,9 @@ mkdir -p $RPM_BUILD_ROOT/etc/init.d/ cp pl_mom $RPM_BUILD_ROOT/etc/init.d/ cp pl_mom.pl $RPM_BUILD_ROOT/usr/local/planetlab/bin/ +cp pl_mop.sh $RPM_BUILD_ROOT/usr/local/planetlab/bin/ + +install -D -m 644 pl_mop.cron $RPM_BUILD_ROOT/etc/cron.d/pl_mop %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT @@ -41,31 +48,37 @@ cp pl_mom.pl $RPM_BUILD_ROOT/usr/local/planetlab/bin/ %defattr(0755, root, root) /etc/init.d/pl_mom /usr/local/planetlab/bin/pl_mom.pl +/usr/local/planetlab/bin/pl_mop.sh +/etc/cron.d/pl_mop %pre %post -RUNLEVEL=`/sbin/runlevel` - if [ "$1" -ge 1 ]; then chkconfig --add pl_mom chkconfig --level 3 pl_mom on - if [[ "$RUNLEVEL" != "unknown" ]]; then + if [[ "$PL_BOOTCD" != "1" ]]; then /etc/init.d/pl_mom stop /etc/init.d/pl_mom start fi + + # Randomize pl_mop run time + M=$((60 * $RANDOM / 32768)) + H=$((24 * $RANDOM / 32768)) + sed -i -e "s/@M@/$M/" -e "s/@H@/$H/" /etc/cron.d/pl_mop fi %preun -RUNLEVEL=`/sbin/runlevel` - if [ "$1" -eq 0 ]; then - if [[ "$RUNLEVEL" != "unknown" ]]; then + if [[ "$PL_BOOTCD" != "1" ]]; then /etc/init.d/pl_mom stop fi + + chkconfig --del pl_mom + chkconfig pl_mom off fi