From 4e416083a7d7e1ded3ef329426920ab74a8794c7 Mon Sep 17 00:00:00 2001 From: Planet-Lab Support Date: Tue, 11 Oct 2005 17:36:55 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create tag 'planetlab-3_1_1-rc3'. --- pl_dod.spec | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 pl_dod.spec diff --git a/pl_dod.spec b/pl_dod.spec new file mode 100644 index 0000000..6f5f669 --- /dev/null +++ b/pl_dod.spec @@ -0,0 +1,89 @@ +%define name pl_dod +%define version 0.2 +%define release 15.planetlab%{?date:.%{date}} + +Summary: PlanetLab mom -- Cleans up your mess +Name: %{name} +Version: %{version} +Release: %{release} +Copyright: dontknow +Group: System Environment/Kernel +Source: %{name}-%{version}.tgz +Vendor: PlanetLab +Packager: PlanetLab Central +Distribution: PlanetLab 2.0 +URL: http://www.planet-lab.org +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%description + +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. + +%prep + +%setup + +%build + +%install +mkdir -p $RPM_BUILD_ROOT/usr/local/planetlab/bin/ +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/ + +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + +%files +%defattr(0755, root, root) +/etc/init.d/pl_mom +/usr/local/planetlab/bin/pl_mom.pl + +%pre +# Cleanup old stuff +if [ -a /var/run/pl_dod.pid ]; then + /etc/init.d/pl_dod stop +fi +cnt=0 +while [ $cnt -le 6 ]; do + file="/etc/rc$cnt.d/K02pl_dod" + if [ -h $file ]; then + rm -f $file + fi + file="/etc/rc$cnt.d/S98pl_dod" + if [ -h $file ]; then + rm -f $file + fi + let "cnt = $cnt + 1" +done + +%post +RUNLEVEL=`/sbin/runlevel` + +if [ "$1" -ge 1 ]; then + + chkconfig --add pl_mom + chkconfig --level 3 pl_mom on + + if [[ "$RUNLEVEL" != "unknown" ]]; then + /etc/init.d/pl_mom stop + /etc/init.d/pl_mom start + fi +fi + +%preun +RUNLEVEL=`/sbin/runlevel` + +if [ "$1" -eq 0 ]; then + if [[ "$RUNLEVEL" != "unknown" ]]; then + /etc/init.d/pl_mom stop + fi +fi + + +%postun + + -- 2.43.0