#! /bin/sh # # Copyright (c) 2008, Red Hat Inc. # # Author: Warren Togami # # 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, you can find it on the World Wide # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA. # # Remove unused LTSP swap files [ -f /etc/ltsp/ltsp.conf ] && . /etc/ltsp/ltsp.conf [ "$LTSP_SWAP_DIR" ] || LTSP_SWAP_DIR=/var/lib/ltsp/swapfiles/ cd $LTSP_SWAP_DIR || exit 1 for ip in `ls *.swap 2>/dev/null | sed s/.swap$//g` do netstat -natup 2>/dev/null | grep ${ip}: >/dev/null && touch ${ip}.swap ping -c 1 -w 10 ${ip} &> /dev/null && touch ${ip}.swap done /usr/sbin/tmpwatch --ctime --atime --mtime 360 $LTSP_SWAP_DIR exit 0