Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r749 - trunk/scripts/admin/test_server

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r749 - trunk/scripts/admin/test_server


Chronological Thread 
  • From: "AFS account Roman Geus" <geus AT savannah.psi.ch>
  • To: idok-commit AT lists.psi.ch
  • Subject: [idok-commit] idok commit r749 - trunk/scripts/admin/test_server
  • Date: Wed, 20 Feb 2008 15:03:03 +0100
  • List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
  • List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>

Author: geus
Date: Wed Feb 20 15:03:03 2008
New Revision: 749

Log:
Added shell script for removing unnecessary files and zeroing out unallocated
disk blocks on a iDok test server

Added:
trunk/scripts/admin/test_server/purge_test_server.sh (contents, props
changed)

Added: trunk/scripts/admin/test_server/purge_test_server.sh
==============================================================================
--- (empty file)
+++ trunk/scripts/admin/test_server/purge_test_server.sh Wed Feb 20
15:03:03 2008
@@ -0,0 +1,69 @@
+#! /bin/bash
+
+##
+## Copyright (C) 2006-2008 iDok team.
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+##
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+##
+
+#
+# Remove unnecessary files on an iDok test server
+#
+# This script is usually executed right before creating a downloadable
+# VMware image.
+#
+# This script should be run with root privileges.
+#
+prompt() {
+ PS3='Select 1 to continue, 2 to skip: '
+ select opt in "Yes" "No"
+ do
+ break
+ done
+ [ "$opt" == "Yes" ] && return 1
+ return 0
+}
+
+# Remove unnecessary files.
+localepurge
+apt-get clean
+rm /var/lib/apt/lists/*gutsy*
+rm /var/cache/apt/*.bin
+rm /etc/resolv.conf
+rm /var/lib/idok_server/derby_backup/*
+
+# Remove log files
+echo -e "\nRemove log files."
+prompt
+[ "$?" -eq "1" ] && find /var/log -type f -exec rm {} \;
+
+# Remove association of network device to MAC address
+rm /etc/udev/rules.d/70-persistent-net.rules
+
+# Zero out unallocated blocks in all file systems on the guest system
+echo -e "\nFill unallocated disk blocks with zeros."
+prompt
+if [ "$?" -eq "1" ]; then
+ cd /
+ cat /dev/zero > zero.fill;sync;sleep 1;sync;ls -l zero.fill;rm -f zero.fill
+ cd /var
+ cat /dev/zero > zero.fill;sync;sleep 1;sync;ls -l zero.fill;rm -f zero.fill
+fi
+
+# Shutdown
+echo -e "\n\nAll done! You should now shutdown and compress the image."
+prompt
+[ "$?" -eq "1" ] && halt



  • [idok-commit] idok commit r749 - trunk/scripts/admin/test_server, AFS account Roman Geus, 02/20/2008

Archive powered by MHonArc 2.6.19.

Top of Page