File: ltsp-swapfile-delete

package info (click to toggle)
ltsp 5.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,932 kB
  • ctags: 271
  • sloc: sh: 5,267; ansic: 1,048; perl: 225; python: 211; lex: 152; makefile: 112; yacc: 59
file content (37 lines) | stat: -rwxr-xr-x 1,343 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /bin/sh
#
#  Copyright (c) 2008, Red Hat Inc.
#
#  Author: Warren Togami <wtogami@redhat.com>
#
#  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