From: Thierry Parmentelat Date: Thu, 10 Apr 2008 14:03:14 +0000 (+0000) Subject: cross-module change -- cleaning vcached, and vserver pre install script X-Git-Tag: util-vserver-pl-0.3-2~7 X-Git-Url: http://git.onelab.eu/?p=util-vserver-pl.git;a=commitdiff_plain;h=64f6ac4e0d88a99c687249d3d7d923f6e2d3f4a8 cross-module change -- cleaning vcached, and vserver pre install script --- diff --git a/Makefile.am b/Makefile.am index 32d0193..b06f63d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,6 @@ pyexec_DATA = python/vserver.py \ sbin_SCRIPTS = python/bwlimit \ python/disklimit \ - scripts/vcached \ scripts/vuseradd \ scripts/vuserdel @@ -50,10 +49,8 @@ sbin_PROGRAMS = src/vip6-autod \ sysv_SCRIPTS = sysv/vip6-autod crondir = $(sysconfdir)/cron.d -cron_DATA = scripts/vcached.cron logrotatedir = $(sysconfdir)/logrotate.d -logrotate_DATA = scripts/vcached.logrotate install-data-hook: install-fix-script-paths diff --git a/scripts/vcached b/scripts/vcached deleted file mode 100755 index 0acd511..0000000 --- a/scripts/vcached +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -# -# vcached: VServer cache allocator -# -# Description: A script that preallocates vservers and stores them in -# a cache. Preallocated vservers from the cache may be then used to -# instantiate real vservers. Requires that /var/run/vcached.pid does -# not exist on startup. Should run periodically as a cron job. -# -# Based on work by: -# -# Brent Chun - bnc@intel-research.net -# Tristan Koo - tristan.koo@intel-research.net -# William Wung - wungism@uclink.berkeley.edu -# -# Mark Huang -# Copyright (c) 2004-2005 The Trustees of Princeton University -# -# $Id$ -# - -PATH=/sbin:/usr/sbin:$PATH - -# number of images to keep cached -slots=32 - -# PID file -pidfile=/var/run/vcached.pid - -# log file -logfile=/var/log/vcached.log - -# debug -debug=0 - -usage() -{ - echo "usage: vcached [OPTION...]" - echo " -s [slots] number of images to keep cached" - echo " -p [pidfile] PID file" - echo " -l [logfile] log file" - echo " -d debug" - exit 1 -} - -# parse options -while getopts 's:p:l:dh' OPT ; do - case "$OPT" in - s) slots=$OPTARG ;; - p) pidfile=$OPTARG ;; - l) logfile=$OPTARG ;; - d) debug=1 ;; - h|*) usage ;; - esac -done - -# append output to log file -exec 1>>$logfile -exec 2>>$logfile - -# check if we are already running -if [ -f $pidfile ] && kill -0 `cat $pidfile` >/dev/null 2>&1 ; then - echo "vcached(`cat $pidfile`) already running" - exit 1 -fi -echo $$ > $pidfile - -# clean up lock file before exiting -trap "rm -f $pidfile" EXIT - -: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} -test -e "$UTIL_VSERVER_VARS" || { - echo "Can not find util-vserver installation; aborting..." - exit 1 -} -. "$UTIL_VSERVER_VARS" - -# make sure barrier bit is set on /vservers to prevent chroot() escapes -setattr --barrier $__DEFAULT_VSERVERDIR - -# take out the trash -#rm -rf "$__DEFAULT_VSERVERDIR/.vtmp" - -mkdir -p "$__DEFAULT_VSERVERDIR/.vcache" -mkdir -p "$__DEFAULT_VSERVERDIR/.vtmp" - -[ $debug -ne 0 ] && echo "$(date) Checking the cache" -for i in $(seq 0 $(($slots - 1))) ; do - if [ ! -d "$__DEFAULT_VSERVERDIR/.vcache/v$i" ] ; then - echo "$(date) Caching v$i" - # build image in .vtmp - TMP=$(mktemp -d "$__DEFAULT_VSERVERDIR/.vtmp/v$i.XXXXXX") - "$_VCLONE" "$__DEFAULT_VSERVERDIR/.vref/default/" "$TMP"/ - RETVAL=$? - # move it to .vcache when complete - if [ $RETVAL -eq 0 ] ; then - mv "$TMP" "$__DEFAULT_VSERVERDIR/.vcache/v$i" - echo "$(date) v$i ready" - else - echo "$(date) Error $RETVAL building v$i" - rm -rf "$TMP" - fi - fi -done - -exit 0 diff --git a/scripts/vcached.cron b/scripts/vcached.cron deleted file mode 100644 index 6a207d5..0000000 --- a/scripts/vcached.cron +++ /dev/null @@ -1,10 +0,0 @@ -# -# vcached: VServer cache allocator -# -# Mark Huang -# Copyright (c) 2004-2005 The Trustees of Princeton University -# -# $Id$ -# - -*/15 * * * * root /usr/sbin/vcached diff --git a/scripts/vcached.logrotate b/scripts/vcached.logrotate deleted file mode 100644 index 203baba..0000000 --- a/scripts/vcached.logrotate +++ /dev/null @@ -1,10 +0,0 @@ -/var/log/vcached.log { - compress - daily - notifempty - rotate 5 - missingok - postrotate - kill -HUP `cat /var/run/vcached.pid 2>/dev/null` 2>/dev/null || true - endscript -} diff --git a/util-vserver-pl.spec b/util-vserver-pl.spec index 3583844..d898f93 100644 --- a/util-vserver-pl.spec +++ b/util-vserver-pl.spec @@ -99,11 +99,6 @@ rm -fr %{buildroot} %{_sbindir}/vip6-autod %{_sysconfdir}/init.d/vip6-autod -%{_sbindir}/vcached -%{_sysconfdir}/cron.d/vcached.cron -%{_sysconfdir}/logrotate.d/vcached.logrotate - - %changelog * Fri Nov 30 2007 Daniel Hokka Zakrisson - 0.1-1 - Initial release