Subversion Repositories DevTools

Rev

Rev 3413 | Rev 4011 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3413 Rev 3423
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#set -x
2
#set -x
-
 
3
################################################################################
-
 
4
#   Script to assist in managing dpkg_archive
-
 
5
#   It may do too much. It does:
-
 
6
#   * Reports free space on drives used
-
 
7
#   * Create a list of files in dpkg_archive - for users to grep
-
 
8
#   * Create a list of packages in dpkg_archive
-
 
9
#   * Generate a report of packages added and removed
-
 
10
#   * Scan dpkg_archive for broen links - at the top level only
-
 
11
#     May be historic. When dpkgarchive was spread over several disks
-
 
12
#   * Scan the 'releases' area for
-
 
13
#     * Broken links
-
 
14
#     * Absolute links
-
 
15
#
-
 
16
#
-
 
17
################################################################################
3
#
18
#
4
#   Config
19
#   Config
5
#
20
#
6
MAILTO=David.Purdie@vixtechnology.com,John.Rowling@vixtechnology.com
21
MAILTO=David.Purdie@vixtechnology.com,John.Rowling@vixtechnology.com
7
FROM=buildadm@vixtechnology.com
22
FROM=buildadm@vixtechnology.com
8
CCTO=
23
CCTO=
9
PATH=$HOME/bin:$PATH
24
PATH=$HOME/bin:$HOME/cron:$PATH
10
DPKG=/export/devl/dpkg_archive
25
DPKG=/export/devl/dpkg_archive
11
RELEASES=/export/devl/releases
26
RELEASES=/export/devl/releases
-
 
27
QUARANTINE=/export/devl/quarantine
12
BASEDIR=$DPKG
28
BASEDIR=$DPKG
13
METADIR=.dpkg_archive/pkg_cron
29
METADIR=.dpkg_archive/pkg_cron
14
OUTDIR=$BASEDIR/$METADIR
30
OUTDIR=$BASEDIR/$METADIR
15
GFIND=/usr/bin/find
31
GFIND=/usr/bin/find
16
GDF=/bin/df
32
GDF=/bin/df
17
MOUNTS="$DPKG $RELEASES"
33
MOUNTS="$DPKG $RELEASES $QUARANTINE"
18
 
34
 
19
 
35
 
20
# Enable null globbing
36
# Enable null globbing
21
#
37
#
22
shopt -s nullglob
38
shopt -s nullglob
Line 238... Line 254...
238
 
254
 
239
    #
255
    #
240
    #   Broken link report
256
    #   Broken link report
241
    #
257
    #
242
    if [ "$DO_SCAN" ] ; then
258
    if [ "$DO_SCAN" ] ; then
-
 
259
        #
243
        [ $DO_VERBOSE ] && echo "Broken Link Scan"
260
        #   Scan dpkg_archive for broken and funny links
-
 
261
        #
244
        echo "" >> $f3
262
        echo "" >> $f3
245
        echo "Dpkg Broken Link Report" >> $f3
263
        echo "Dpkg_archive Link Report" >> $f3
246
        $GFIND -L $BASEDIR  -maxdepth 1 -type l -ls >> $f3
-
 
247
 
-
 
248
#        #
-
 
249
#        #   Scan deploy mount for oddities
-
 
250
#        #
-
 
251
#        [ $DO_VERBOSE ] && echo "Deploy Mount Point Scan"
-
 
252
#        echo "" >> $f3
-
 
253
#        echo "Deploy Mount Point Scan" >> $f3
-
 
254
#        for pkg in $( $GFIND -L $DEPLOY -maxdepth 1 ) ; do
-
 
255
#            name=${pkg#$DEPLOY/}
-
 
256
#
-
 
257
#            # Skip root of the search
-
 
258
#            if [ "$name" = "$pkg" ] ; then
-
 
259
#                continue
-
 
260
#            fi
-
 
261
#
-
 
262
#            # Don't expect files in the deploy mount
-
 
263
#            if [ -f $pkg ] ; then
-
 
264
#                echo Suspect file: $pkg
-
 
265
#                continue
-
 
266
#            fi
-
 
267
#
-
 
268
#            # Don't expect links in the deploy mount
-
 
269
#            if [ -L $pkg ] ; then
-
 
270
#                echo Suspect Link: $pkg
-
 
271
#            fi
-
 
272
#    
-
 
273
#            if [ ! -d $DPKG/$name ] ; then
-
 
274
#                echo Missing Link: $pkg
-
 
275
#            fi
-
 
276
#        done | sort >> $f3
264
        scan_release.pl $DPKG >> $f3
277
 
265
 
278
        #
266
        #
279
        #   Scan releases area for broken and funny links
267
        #   Scan releases area for broken and funny links
280
        #
268
        #
281
        echo "" >> $f3
269
        echo "" >> $f3
Line 290... Line 278...
290
    #
278
    #
291
    #   Mail results
279
    #   Mail results
292
    #
280
    #
293
    if [ "$DO_MAIL" ] ; then
281
    if [ "$DO_MAIL" ] ; then
294
        [ $DO_VERBOSE ] && echo "Mailing Results"
282
        [ $DO_VERBOSE ] && echo "Mailing Results"
295
        echo "Mailing results"
-
 
296
        sendEmail.pl -q -f ${FROM} -t ${MAILTO} ${CCTO} -u "[dpkg_archive] $DATE Archive Report from $HOSTNAME" '-o' 'message-content-type=html' -o "message-file=$f3"
283
        sendEmail.pl -q -f ${FROM} -t ${MAILTO} ${CCTO} -u "[dpkg_archive] $DATE Archive Report from $HOSTNAME" '-o' 'message-content-type=html' -o "message-file=$f3"
297
#        (
-
 
298
#            cat $f3
-
 
299
#        ) | mail_files.ksh -t ${MAILTO} ${CCTO} -s "[dpkg_archive] $DATE Archive Report from $HOSTNAME" #-b $f3
-
 
300
    else
284
    else
301
        cat $f3
285
        cat $f3
302
    fi
286
    fi
303
 
287
 
304
else
288
else
Line 311... Line 295...
311
#   Clean up
295
#   Clean up
312
#
296
#
313
rm -f /tmp/$$.file*
297
rm -f /tmp/$$.file*
314
 
298
 
315
#
299
#
316
#   Remove old copies of files
300
#   Remove old copies of files from the metadata directory
317
#
301
#
318
$GFIND $OUTDIR -type f -mtime +100 -exec rm -f  {} \;
302
$GFIND $OUTDIR -type f -mtime +100 -exec rm -f  {} \;
319
 
303
 
320
 
304