[PC-BSD Commits] r4628 - in pcbsd/trunk/system-overlay: etc usr/PCBSD/Scripts usr/local/etc/rc.d

svn at pcbsd.org svn at pcbsd.org
Fri Oct 9 10:39:59 PDT 2009


Author: kris
Date: 2009-10-09 10:39:59 -0700 (Fri, 09 Oct 2009)
New Revision: 4628

Added:
   pcbsd/trunk/system-overlay/usr/local/etc/rc.d/swapmonitor
Removed:
   pcbsd/trunk/system-overlay/etc/rc.local
Modified:
   pcbsd/trunk/system-overlay/etc/rc.conf
   pcbsd/trunk/system-overlay/usr/PCBSD/Scripts/swapmonitor.sh
Log:

Updated the swapmonitor in 8.0, uses regular rc.d script now, can be restarted easily

Also removed rc.local, not needed anymore



Modified: pcbsd/trunk/system-overlay/etc/rc.conf
===================================================================
--- pcbsd/trunk/system-overlay/etc/rc.conf	2009-10-09 16:58:19 UTC (rev 4627)
+++ pcbsd/trunk/system-overlay/etc/rc.conf	2009-10-09 17:39:59 UTC (rev 4628)
@@ -74,5 +74,11 @@
 snddetect_enable="YES"
 mixer_enable="YES"
 
+# Enable avahi_daemon
+avahi_daemon_enable="YES"
+
 # Run the port jail
 portjail_enable="YES"
+
+# Start the swapmonitor
+swapmonitor_enable="YES"

Modified: pcbsd/trunk/system-overlay/usr/PCBSD/Scripts/swapmonitor.sh
===================================================================
--- pcbsd/trunk/system-overlay/usr/PCBSD/Scripts/swapmonitor.sh	2009-10-09 16:58:19 UTC (rev 4627)
+++ pcbsd/trunk/system-overlay/usr/PCBSD/Scripts/swapmonitor.sh	2009-10-09 17:39:59 UTC (rev 4628)
@@ -3,13 +3,15 @@
 # Monitors swap space usage and activates 256MB increments as needed
 ##############################################################################
 
-mkdir /swap >/dev/null 2>/dev/null
+SWAPDIR="/usr/swap"
 
+mkdir ${SWAPDIR} >/dev/null 2>/dev/null
+
 if [ "${1}" = "-daemon" ]
 then
   # Assume we have no active swap, and clean up any old files
-  rm /swap/*.swap 2>/dev/null
-  rm /swap/*.id 2>/dev/null
+  rm ${SWAPDIR}/*.swap 2>/dev/null
+  rm ${SWAPDIR}/*.id 2>/dev/null
 fi
 
 
@@ -30,20 +32,20 @@
 then
 
   # Make sure the directory exists
-  mkdir /swap >/dev/null 2>/dev/null
+  mkdir ${SWAPDIR} >/dev/null 2>/dev/null
 
   i="0"
   # Get list of swap devices and increment by 1
-  for j in `ls /swap/swap*.swap 2>/dev/null`
+  for j in `ls ${SWAPDIR}/swap*.swap 2>/dev/null`
   do
     i="`expr ${i} + 1`" 
   done
 
-  echo "Enabing new swap on /swap/swap${i}.swap"
-  dd if=/dev/zero of=/swap/swap${i}.swap count=256000 bs=1024 >/dev/null 2>/dev/null
-  MD="`mdconfig -f /swap/swap${i}.swap -o compress`"
+  echo "Enabing new swap on ${SWAPDIR}/swap${i}.swap"
+  dd if=/dev/zero of=${SWAPDIR}/swap${i}.swap count=256000 bs=1024 >/dev/null 2>/dev/null
+  MD="`mdconfig -f ${SWAPDIR}/swap${i}.swap -o compress`"
   swapon /dev/${MD}
-  echo "${MD}" > /swap/swap${i}.id
+  echo "${MD}" > ${SWAPDIR}/swap${i}.id
 
 fi
 
@@ -53,15 +55,15 @@
 
   i="0"
   # Get list of swap devices and increment by 1
-  for j in `ls /swap/swap*.swap 2>/dev/null`
+  for j in `ls ${SWAPDIR}/swap*.swap 2>/dev/null`
   do
     i="`expr ${i} + 1`" 
   done
   i="`expr ${i} - 1`" 
   
-  if [ -f "/swap/swap${i}.id" ]
+  if [ -f "${SWAPDIR}/swap${i}.id" ]
   then
-    echo "Removing extra swap on /swap/swap${i}.swap"
+    echo "Removing extra swap on ${SWAPDIR}/swap${i}.swap"
     # Stop the swap
     swapoff /dev/${MD}
 
@@ -69,9 +71,9 @@
     mdconfig -d -u /dev/${MD} 
 
     # Remove the actual swap file
-    rm /swap/swap${i}.swap
+    rm ${SWAPDIR}/swap${i}.swap
     # Remove the id file
-    rm /swap/swap${i}.id
+    rm ${SWAPDIR}/swap${i}.id
   fi
 
 fi


Property changes on: pcbsd/trunk/system-overlay/usr/local/etc/rc.d/swapmonitor
___________________________________________________________________
Added: svn:executable
   + *



More information about the Commits mailing list