Mercurial > hg > foxridge-archiver
changeset 23:a3c35eae25dc
added count in archivemany
removed abort on wrong user in archiver (problem with screen)
author | casties |
---|---|
date | Fri, 23 Sep 2005 19:16:17 +0200 |
parents | c3defe3e2780 |
children | 1dd183b95c61 |
files | archivemany.sh archiver.pl |
diffstat | 2 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/archivemany.sh Tue Sep 20 19:44:48 2005 +0200 +++ b/archivemany.sh Fri Sep 23 19:16:17 2005 +0200 @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="archivemany V0.1 (14.6.2005 ROC)" +VERSION="archivemany V0.2 (23.9.2005 ROC)" #set -x @@ -15,6 +15,7 @@ BASEDIR="$1" DIRLIST="$2" PARAM="$3" +CNT="1" if [ ! -d $BASEDIR ] then @@ -32,7 +33,7 @@ do if [ -d "$BASEDIR/$DIR" ] then - echo "archiving $DIR..." + echo "archiving document $CNT: $DIR..." if /usr/local/mpiwg/archive/archiver "$PARAM" "$BASEDIR/$DIR" then echo " done on `date`" @@ -43,4 +44,5 @@ else echo "ERROR: document directory $BASEDIR/$DIR not found!" fi + CNT=$(( $CNT + 1 )) done
--- a/archiver.pl Tue Sep 20 19:44:48 2005 +0200 +++ b/archiver.pl Fri Sep 23 19:16:17 2005 +0200 @@ -16,7 +16,7 @@ # # program version -my $version = "0.7 (ROC 20.9.2005)"; +my $version = "0.7.1 (ROC 23.9.2005)"; # short help my $help = "MPIWG archiver $version @@ -274,7 +274,7 @@ next unless (-f $f); # delete files if (unlink $f) { - logger('INFO', "remove $f ($fn)"); + logger('DEBUG', "remove $f ($fn)"); } else { logger('ERROR', "unable to delete $f!"); $errcnt++; @@ -288,7 +288,7 @@ # dont't remove document dir (shouldn't be empty anyway) next if ($d eq $docdir); if (-d $d) { - logger('INFO', "remove dir $d"); + logger('DEBUG', "remove dir $d"); rmdir $d; } } @@ -319,7 +319,7 @@ if (-f "$dir/$f") { # $f is a file if (unlink "$dir/$f") { - logger('INFO', "removed $f"); + logger('DEBUG', "removed $f"); } else { logger('ERROR', "unable to delete $f!"); $errcnt++; @@ -327,7 +327,7 @@ } elsif (-d _) { # $f is a directory (unlink won't work) if ((system 'rm', '-r', "$dir/$f") == 0) { - logger('INFO', "removed directory $f"); + logger('DEBUG', "removed directory $f"); } else { logger('ERROR', "unable to delete directory $f!"); $errcnt++; @@ -357,8 +357,7 @@ # make shure the right user is running this program my $user = getlogin; if (($user ne "archive")&&($user ne "root")) { - logger("ABORT", "you ($user) must be archive or root user to run this program!"); - exit 1; + logger("WARNING", "you ($user) should be archive or root user to run this program!"); } # check for .archived file