diff options
author | 2004-09-16 11:21:04 +0000 | |
---|---|---|
committer | 2004-09-16 11:21:04 +0000 | |
commit | 7e47761b198e1305b9a195e6e84ccff294bfe7d7 (patch) | |
tree | 00f6411861c90a59cf050f4fc4ed82bdbb18458f /app-misc | |
parent | Stupid idea (diff) | |
download | overlay-7e47761b198e1305b9a195e6e84ccff294bfe7d7.tar.gz overlay-7e47761b198e1305b9a195e6e84ccff294bfe7d7.tar.bz2 overlay-7e47761b198e1305b9a195e6e84ccff294bfe7d7.zip |
Removed
svn path=/; revision=45
Diffstat (limited to 'app-misc')
29 files changed, 0 insertions, 1053 deletions
diff --git a/app-misc/scripts-gw/files/SVN-daily b/app-misc/scripts-gw/files/SVN-daily deleted file mode 100755 index e591552..0000000 --- a/app-misc/scripts-gw/files/SVN-daily +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-daily" - echo " or: SVN-daily encrypt@for.user" - echo - echo "Dumps the subversion repositories to /var/svn/dump" - echo "and encrypts the dump if a recipient is given. The dump" - echo "is incremental." - exit 0 -fi - -BIN_DUMP="/usr/sbin/SVN-dump" - -for REPOSITORY in /var/svn/repos/* - do - $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump incremental -done - -if [ "x$1" != "x" ]; then - for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE ] && /usr/bin/gpg --default-recipient $1 --encrypt-files $FILE && rm $FILE - done -fi - -chown -R apache:apache /var/svn/dump -chmod 750 /var/svn/dump -chmod 660 /var/svn/dump/* - diff --git a/app-misc/scripts-gw/files/SVN-dump b/app-misc/scripts-gw/files/SVN-dump deleted file mode 100755 index a812774..0000000 --- a/app-misc/scripts-gw/files/SVN-dump +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -my $repos_path = $ARGV[0]; -my $dumpfile = $ARGV[1]; -my $type = $ARGV[2]; - -my $bin_svnadmin = `which svnadmin`; -my $bin_svnlook = `which svnlook`; -my $bin_bz2 = `which bzip2`; - -$bin_svnlook =~ s/\n//; -$bin_svnadmin =~ s/\n//; -$bin_bz2 =~ s/\n//; - -if ($bin_svnadmin eq "") {$bin_svnadmin = "/usr/bin/svnadmin"}; -if ($bin_svnlook eq "") {$bin_svnlook = "/usr/bin/svnlook"}; -if ($bin_bz2 eq "") {$bin_bz2 = "/bin/bzip2"}; - -# Figure out the starting revision. Use 0 if we cannot read the -# last-dumped file, else use the revision in that file incremented -# by 1. -my $new_start = 0; -if (open LASTDUMPED, "$dumpfile.last") -{ - my $line = <LASTDUMPED>; - if (defined $line and $line =~ /^(\d+)/) - { - $new_start = $1 + 1; - } - close LASTDUMPED; -} - -# Query the youngest revision in the repos. -my $youngest = `$bin_svnlook youngest $repos_path`; -defined $youngest && $youngest =~ /^\d+$/ - or die "$0: 'svnlook youngest $repos_path' cannot get youngest revision.\n"; -chomp $youngest; - -if ($type eq "incremental") -{ - if ($new_start > $youngest) - { - print "Nothing to do!\n"; - } else { - ## Do the backup. - system("$bin_svnadmin dump $repos_path --revision $new_start:$youngest --incremental >> $dumpfile.tmp") == 0 - or die "$0: svnadmin dump to '$dumpfile.tmp' failed.\n"; - - # Store a new last-dumped revision. - open LASTDUMPED, "> $dumpfile.last.tmp" - or die "$0: cannot open '$dumpfile.last.tmp' for writing: $!\n"; - print LASTDUMPED "$youngest\n"; - close LASTDUMPED - or die "$0: error in closing '$dumpfile.last.tmp' for writing: $!\n"; - - # Rename to final locations. - rename("$dumpfile.tmp", "$dumpfile.$new_start.$youngest") - or die "$0: cannot rename '$dumpfile.tmp' to '$dumpfile': $!\n"; - - rename("$dumpfile.last.tmp", "$dumpfile.last") - or die "$0: cannot rename '$dumpfile.last.tmp' to '$dumpfile.last': $!\n"; - - system("$bin_bz2 $dumpfile.$new_start.$youngest") == 0 - or die "$0: compressing dump file $dumpfile.$new_start.$youngest failed.\n"; - } -} else { - - system("$bin_svnadmin dump $repos_path >> $dumpfile.full.tmp") == 0 - or die "$0: svnadmin dump to '$dumpfile.tmp' failed.\n"; - - rename("$dumpfile.full.tmp", "$dumpfile.full") - or die "$0: cannot rename '$dumpfile.full.tmp' to '$dumpfile.full': $!\n"; - - system("$bin_bz2 -f $dumpfile.full") == 0 - or die "$0: compressing dump file $dumpfile.full failed.\n"; -} -# All done! diff --git a/app-misc/scripts-gw/files/SVN-etc b/app-misc/scripts-gw/files/SVN-etc deleted file mode 100755 index c802770..0000000 --- a/app-misc/scripts-gw/files/SVN-etc +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-etc /backup/dir \"commit message\"" - echo - echo "Copies the /etc directory into the given /backup/dir/etc" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/etc/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add etc -fi - -date > $LOGFILE -date > $ERRFILE - -rsync -rptgo --delete-after --exclude ".svn/" /etc/ $BASEDIR 2>> $ERRFILE | grep -v "skipping" -cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done -cd $BASEDIR && svn status | grep '^!' | sed -e 's/^!//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn rm &> $LOGFILE -cd $BASEDIR && svn status | grep '^?' | sed -e 's/^?//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn add &> $LOGFILE - -MESSAGE="$2" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE diff --git a/app-misc/scripts-gw/files/SVN-html b/app-misc/scripts-gw/files/SVN-html deleted file mode 100755 index 95bf9f7..0000000 --- a/app-misc/scripts-gw/files/SVN-html +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-html /backup/dir \"commit message\"" - echo - echo "Copies the /var/www directory into the given /backup/dir/html" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/html/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add html -fi - -date > $LOGFILE -date > $ERRFILE - -rsync -rptgo --delete-after --exclude ".svn/" /var/www/ $BASEDIR 2>> $ERRFILE | grep -v "skipping" -cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done -cd $BASEDIR && svn status | grep '^!' | sed -e 's/^!//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn rm &> $LOGFILE -cd $BASEDIR && svn status | grep '^?' | sed -e 's/^?//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn add &> $LOGFILE - -MESSAGE="$2" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE - diff --git a/app-misc/scripts-gw/files/SVN-ldap b/app-misc/scripts-gw/files/SVN-ldap deleted file mode 100755 index 7ee7681..0000000 --- a/app-misc/scripts-gw/files/SVN-ldap +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-ldap /backup/dir \"commit message\"" - echo - echo "Dumps all mysql databases into the given /backup/dir/ldap" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/ldap/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add ldap -fi - -date > $LOGFILE -date > $ERRFILE - -slapcat > $BASEDIR/ldap.dump - -MESSAGE="$2" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE diff --git a/app-misc/scripts-gw/files/SVN-monthly b/app-misc/scripts-gw/files/SVN-monthly deleted file mode 100755 index 8c9cc86..0000000 --- a/app-misc/scripts-gw/files/SVN-monthly +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-monthly" - echo " or: SVN-monthly encrypt@for.user" - echo - echo "Dumps the subversion repositories to /var/svn/dump" - echo "and encrypts the dump if a recipient is given. The dump" - echo "is a complete dump." - exit 0 -fi - -BIN_DUMP="/usr/sbin/SVN-dump" - -for REPOSITORY in /var/svn/repos/* - do - $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump full -done - -if [ "x$1" != "x" ]; then - for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE ] && /usr/bin/gpg --default-recipient $1 --encrypt-files $FILE && rm $FILE - done -fi - -chown -R apache:apache /var/svn/dump -chmod 750 /var/svn/dump -chmod 660 /var/svn/dump/* - diff --git a/app-misc/scripts-gw/files/SVN-mysql b/app-misc/scripts-gw/files/SVN-mysql deleted file mode 100755 index 5c0d6c2..0000000 --- a/app-misc/scripts-gw/files/SVN-mysql +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-mysql /backup/dir mysql-root-pass \"commit message\"" - echo - echo "Dumps all mysql databases into the given /backup/dir/mysql" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/mysql/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add mysql -fi - -date > $LOGFILE -date > $ERRFILE - -mysql-dump-all ${2} $BASEDIR - -MESSAGE="$3" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE diff --git a/app-misc/scripts-gw/files/birthDay b/app-misc/scripts-gw/files/birthDay deleted file mode 100755 index b0acb56..0000000 --- a/app-misc/scripts-gw/files/birthDay +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl - -use Date::Calc qw(:all); -use Net::SMTP; - -($year,$month,$day) = Today(); -($hour,$min,$sec) = Now(); - -my $server = $ARGV[0]; -my $ldapdc = $ARGV[1]; -my $ldpass = $ARGV[2]; - -system("ldapsearch -x -LL -H $server -b $ldapdc -s sub -D cn=admin,$ldapdc -w $ldpass \"(birthDate=*)\" cn mail birthDate > /tmp/birthday.tmp"); - -open BDAY, "</tmp/birthday.tmp"; - -while ($line = <BDAY>) -{ - if($line =~ /^dn:/) - { - $user = $line; - } - if($line =~ /^cn:/) - { - ($bday{$user}{"NAME"}) = ($line =~ /cn: (.*)/); - } - if($line =~ /^mail:/) - { - ($bday{$user}{"MAIL"}) = ($line =~ /mail: (.*)/); - } - if($line =~ /^birthDate:/) - { - ($bday{$user}{"BDAY"}{"YEAR"}, $bday{$user}{"BDAY"}{"MONTH"}, $bday{$user}{"BDAY"}{"DAY"}) = ($line =~ /birthDate: (\d\d\d\d)-(\d\d)-(\d\d).*/); - $bday{$user}{"AGE"} = ($year - $bday{$user}{"BDAY"}{"YEAR"}); - $bday{$user}{"TLEFT"} = Delta_Days($year, $month, $day, $year, $bday{$user}{"BDAY"}{"MONTH"}, $bday{$user}{"BDAY"}{"DAY"}); - } -} - -foreach $user (keys %bday) -{ - if ($bday{$user}{"TLEFT"}==7 || $bday{$user}{"TLEFT"}==-358) - { - &bdayMail($bday{$user}{"NAME"},$bday{$user}{"MAIL"},$bday{$user}{"AGE"},"Der Geburtstag von " . $bday{$user}{"NAME"} . " naht!", $bday{$user}{"BDAY"}{"DAY"} . "." . $bday{$user}{"BDAY"}{"MONTH"}); - } - if ($bday{$user}{"TLEFT"}==0) - { - &bdayMail($bday{$user}{"NAME"},$bday{$user}{"MAIL"},$bday{$user}{"AGE"},"Heute hat " . $bday{$user}{"NAME"} . " Geburtstag!", $bday{$user}{"BDAY"}{"DAY"} . "." . $bday{$user}{"BDAY"}{"MONTH"}); - } -} - -system("rm /tmp/birthday.tmp"); - -sub bdayMail { - $smtp = Net::SMTP->new('localhost') - or die "Can't connect SMTP localhost!\n"; - - $recp{'post@gunnarwrobel.de'}{"NAME"} = "Gunnar"; - - $date = sprintf("%.3s, %02d %.3s %d %d:%d:%d +0200", - Day_of_Week_to_Text(Day_of_Week($year,$month,$day)), - $day, - Month_to_Text($month), - $year,$hour,$min,$sec); - - foreach $localname (keys %recp) - { - $mail = 'From: Birthday Skript <system@gunnarwrobel.de>' . "\n"; - $mail .= "To: " . $recp{$localname}{"NAME"} . " <" . $localname .">\n"; - $mail .= "Date: " . $date . "\n"; - $mail .= "Subject: " . $_[3] . "\n\n"; - $mail .= "Am " . $_[4] . " wird " . $_[0] . " " . $_[2] . " Jahre alt.\n\n"; - if (!$_[1] eq "") - { - $mail .= "Falls Du eine Mail schreiben moechtest: " . $_[1] . "\n"; - } - $smtp->mail('system@gunnarwrobel.de'); - $smtp->to($localname); - $smtp->data(); - $smtp->datasend($mail); - $smtp->dataend(); - $smtp->quit; - } -} diff --git a/app-misc/scripts-gw/files/check-ALLWRITE b/app-misc/scripts-gw/files/check-ALLWRITE deleted file mode 100755 index ac2691b..0000000 --- a/app-misc/scripts-gw/files/check-ALLWRITE +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -LOG=/root/.log/read.log -LOG_OLD=/root/.log/read.log.old -mv $LOG $LOG_OLD -find / -xdev -perm +o=w ! \( -type d -perm +o=t \) ! -type l -print > $LOG - -diff -Nau $LOG_OLD $LOG -echo "##################################################" -cat $LOG_OLD -echo "##################################################" -cat $LOG -rm $LOG_OLD diff --git a/app-misc/scripts-gw/files/check-SUID b/app-misc/scripts-gw/files/check-SUID deleted file mode 100755 index 5740da4..0000000 --- a/app-misc/scripts-gw/files/check-SUID +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -LOG=/root/.log/suid.log -LOG_OLD=/root/.log/suid.log.old -mv $LOG $LOG_OLD -find / -xdev -type f -perm +ug=s -print > $LOG - -diff -Nau $LOG_OLD $LOG -echo "##################################################" -cat $LOG_OLD -echo "##################################################" -cat $LOG -rm $LOG_OLD diff --git a/app-misc/scripts-gw/files/dailyRoutine b/app-misc/scripts-gw/files/dailyRoutine deleted file mode 100755 index cc163e2..0000000 --- a/app-misc/scripts-gw/files/dailyRoutine +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -MYSQLPASS="$1" -GPGUSER="$2" -BACKUP="/root/opt/backup" - -echo "---------------------" -echo "-- TIME CORRECTION " -echo "---------------------" -echo - -ntpd -q - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "NOW:" -echo -date -echo "---------------------" -echo - -echo "---------------------" -echo "-- BACKUP " -echo "---------------------" -echo - -SVN-etc ${BACKUP} "AutomaticUpdate" -SVN-html ${BACKUP} "AutomaticUpdate" -SVN-mysql ${BACKUP} ${MYSQLPASS} "AutomaticUpdate" -SVN-ldap ${BACKUP} "AutomaticUpdate" - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- SVN BACKUP " -echo "---------------------" -echo - -SVN-daily ${GPGUSER} | grep -v "skipping" - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- APACHE STATS" -echo "---------------------" -echo - -/etc/analog/analog.daily - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- MAIL" -echo "---------------------" -echo - -rsync -rtpvz --delete-after /var/spool/mail/ /home/wrobel/mail/backup/ -chown -R wrobel:users /home/wrobel/mail/backup - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- GENERAL" -echo "---------------------" -echo - -slocate -u -texpire -check-SUID -check-ALLWRITE -horde.fetchmail -emerge --nospinner sync >> /var/log/portage.log -emerge --nospinner --pretend world -birthDay -logwatch.pl --detail 10 -logrotate /etc/logrotate.conf - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "NOW:" -echo -date -echo "---------------------" -echo diff --git a/app-misc/scripts-gw/files/emerge-single b/app-misc/scripts-gw/files/emerge-single deleted file mode 100755 index aa41c12..0000000 --- a/app-misc/scripts-gw/files/emerge-single +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -X=`/usr/bin/emerge -p $1 | /bin/grep '^\[' | /bin/wc | /bin/awk '{print $1}'` - -/usr/bin/test $X -eq 1 && emerge $1 && exit 0 - -echo $'\e[31;01m'"This would emerge more than one ebuild!" - -exit 1 diff --git a/app-misc/scripts-gw/files/mysql-dump-all b/app-misc/scripts-gw/files/mysql-dump-all deleted file mode 100755 index 6cbf58c..0000000 --- a/app-misc/scripts-gw/files/mysql-dump-all +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: mysql-dump-all mysql-root-pass /backup/dir" - echo - echo "Dumps all mysql databases into the given /backup/dir/" - exit 0 -fi - -DBS=`mysql -u root -p${1} -s -e 'show databases;' | grep -v 'Database'` - -for db in $DBS -do - mysqldump -u root -p${1} ${db} > ${2}/${db}.sql -done diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/Makefile b/app-misc/scripts-gw/files/scripts-gw-1.0/Makefile deleted file mode 100644 index 058627c..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -SBINSCRIPTS = SVN-dump SVN-html SVN-monthly birthDay check-SUID tripUpdate SVN-daily SVN-etc SVN-ldap SVN-mysql check-ALLWRITE dailyRoutine mysql-dump-all -BINSCRIPTS = emerge-single - -all: - echo "No compilation necessary!" - -install: $(SBINSCRIPTS) $(BINSCRIPTS) - install -g root -o root -m 755 $(SBINSCRIPTS) /usr/sbin - install -g root -o root -m 755 $(SBINSCRIPTS) /usr/bin diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-daily b/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-daily deleted file mode 100755 index e591552..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-daily +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-daily" - echo " or: SVN-daily encrypt@for.user" - echo - echo "Dumps the subversion repositories to /var/svn/dump" - echo "and encrypts the dump if a recipient is given. The dump" - echo "is incremental." - exit 0 -fi - -BIN_DUMP="/usr/sbin/SVN-dump" - -for REPOSITORY in /var/svn/repos/* - do - $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump incremental -done - -if [ "x$1" != "x" ]; then - for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE ] && /usr/bin/gpg --default-recipient $1 --encrypt-files $FILE && rm $FILE - done -fi - -chown -R apache:apache /var/svn/dump -chmod 750 /var/svn/dump -chmod 660 /var/svn/dump/* - diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-dump b/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-dump deleted file mode 100755 index a812774..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-dump +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -my $repos_path = $ARGV[0]; -my $dumpfile = $ARGV[1]; -my $type = $ARGV[2]; - -my $bin_svnadmin = `which svnadmin`; -my $bin_svnlook = `which svnlook`; -my $bin_bz2 = `which bzip2`; - -$bin_svnlook =~ s/\n//; -$bin_svnadmin =~ s/\n//; -$bin_bz2 =~ s/\n//; - -if ($bin_svnadmin eq "") {$bin_svnadmin = "/usr/bin/svnadmin"}; -if ($bin_svnlook eq "") {$bin_svnlook = "/usr/bin/svnlook"}; -if ($bin_bz2 eq "") {$bin_bz2 = "/bin/bzip2"}; - -# Figure out the starting revision. Use 0 if we cannot read the -# last-dumped file, else use the revision in that file incremented -# by 1. -my $new_start = 0; -if (open LASTDUMPED, "$dumpfile.last") -{ - my $line = <LASTDUMPED>; - if (defined $line and $line =~ /^(\d+)/) - { - $new_start = $1 + 1; - } - close LASTDUMPED; -} - -# Query the youngest revision in the repos. -my $youngest = `$bin_svnlook youngest $repos_path`; -defined $youngest && $youngest =~ /^\d+$/ - or die "$0: 'svnlook youngest $repos_path' cannot get youngest revision.\n"; -chomp $youngest; - -if ($type eq "incremental") -{ - if ($new_start > $youngest) - { - print "Nothing to do!\n"; - } else { - ## Do the backup. - system("$bin_svnadmin dump $repos_path --revision $new_start:$youngest --incremental >> $dumpfile.tmp") == 0 - or die "$0: svnadmin dump to '$dumpfile.tmp' failed.\n"; - - # Store a new last-dumped revision. - open LASTDUMPED, "> $dumpfile.last.tmp" - or die "$0: cannot open '$dumpfile.last.tmp' for writing: $!\n"; - print LASTDUMPED "$youngest\n"; - close LASTDUMPED - or die "$0: error in closing '$dumpfile.last.tmp' for writing: $!\n"; - - # Rename to final locations. - rename("$dumpfile.tmp", "$dumpfile.$new_start.$youngest") - or die "$0: cannot rename '$dumpfile.tmp' to '$dumpfile': $!\n"; - - rename("$dumpfile.last.tmp", "$dumpfile.last") - or die "$0: cannot rename '$dumpfile.last.tmp' to '$dumpfile.last': $!\n"; - - system("$bin_bz2 $dumpfile.$new_start.$youngest") == 0 - or die "$0: compressing dump file $dumpfile.$new_start.$youngest failed.\n"; - } -} else { - - system("$bin_svnadmin dump $repos_path >> $dumpfile.full.tmp") == 0 - or die "$0: svnadmin dump to '$dumpfile.tmp' failed.\n"; - - rename("$dumpfile.full.tmp", "$dumpfile.full") - or die "$0: cannot rename '$dumpfile.full.tmp' to '$dumpfile.full': $!\n"; - - system("$bin_bz2 -f $dumpfile.full") == 0 - or die "$0: compressing dump file $dumpfile.full failed.\n"; -} -# All done! diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-etc b/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-etc deleted file mode 100755 index c802770..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-etc +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-etc /backup/dir \"commit message\"" - echo - echo "Copies the /etc directory into the given /backup/dir/etc" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/etc/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add etc -fi - -date > $LOGFILE -date > $ERRFILE - -rsync -rptgo --delete-after --exclude ".svn/" /etc/ $BASEDIR 2>> $ERRFILE | grep -v "skipping" -cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done -cd $BASEDIR && svn status | grep '^!' | sed -e 's/^!//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn rm &> $LOGFILE -cd $BASEDIR && svn status | grep '^?' | sed -e 's/^?//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn add &> $LOGFILE - -MESSAGE="$2" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-html b/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-html deleted file mode 100755 index 95bf9f7..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-html +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-html /backup/dir \"commit message\"" - echo - echo "Copies the /var/www directory into the given /backup/dir/html" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/html/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add html -fi - -date > $LOGFILE -date > $ERRFILE - -rsync -rptgo --delete-after --exclude ".svn/" /var/www/ $BASEDIR 2>> $ERRFILE | grep -v "skipping" -cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done -cd $BASEDIR && svn status | grep '^!' | sed -e 's/^!//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn rm &> $LOGFILE -cd $BASEDIR && svn status | grep '^?' | sed -e 's/^?//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn add &> $LOGFILE - -MESSAGE="$2" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE - diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-ldap b/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-ldap deleted file mode 100755 index 7ee7681..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-ldap +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-ldap /backup/dir \"commit message\"" - echo - echo "Dumps all mysql databases into the given /backup/dir/ldap" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/ldap/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add ldap -fi - -date > $LOGFILE -date > $ERRFILE - -slapcat > $BASEDIR/ldap.dump - -MESSAGE="$2" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-monthly b/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-monthly deleted file mode 100755 index 8c9cc86..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-monthly +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-monthly" - echo " or: SVN-monthly encrypt@for.user" - echo - echo "Dumps the subversion repositories to /var/svn/dump" - echo "and encrypts the dump if a recipient is given. The dump" - echo "is a complete dump." - exit 0 -fi - -BIN_DUMP="/usr/sbin/SVN-dump" - -for REPOSITORY in /var/svn/repos/* - do - $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump full -done - -if [ "x$1" != "x" ]; then - for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE ] && /usr/bin/gpg --default-recipient $1 --encrypt-files $FILE && rm $FILE - done -fi - -chown -R apache:apache /var/svn/dump -chmod 750 /var/svn/dump -chmod 660 /var/svn/dump/* - diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-mysql b/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-mysql deleted file mode 100755 index 5c0d6c2..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/SVN-mysql +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-mysql /backup/dir mysql-root-pass \"commit message\"" - echo - echo "Dumps all mysql databases into the given /backup/dir/mysql" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi - -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/mysql/ - -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add mysql -fi - -date > $LOGFILE -date > $ERRFILE - -mysql-dump-all ${2} $BASEDIR - -MESSAGE="$3" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/birthDay b/app-misc/scripts-gw/files/scripts-gw-1.0/birthDay deleted file mode 100755 index b0acb56..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/birthDay +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl - -use Date::Calc qw(:all); -use Net::SMTP; - -($year,$month,$day) = Today(); -($hour,$min,$sec) = Now(); - -my $server = $ARGV[0]; -my $ldapdc = $ARGV[1]; -my $ldpass = $ARGV[2]; - -system("ldapsearch -x -LL -H $server -b $ldapdc -s sub -D cn=admin,$ldapdc -w $ldpass \"(birthDate=*)\" cn mail birthDate > /tmp/birthday.tmp"); - -open BDAY, "</tmp/birthday.tmp"; - -while ($line = <BDAY>) -{ - if($line =~ /^dn:/) - { - $user = $line; - } - if($line =~ /^cn:/) - { - ($bday{$user}{"NAME"}) = ($line =~ /cn: (.*)/); - } - if($line =~ /^mail:/) - { - ($bday{$user}{"MAIL"}) = ($line =~ /mail: (.*)/); - } - if($line =~ /^birthDate:/) - { - ($bday{$user}{"BDAY"}{"YEAR"}, $bday{$user}{"BDAY"}{"MONTH"}, $bday{$user}{"BDAY"}{"DAY"}) = ($line =~ /birthDate: (\d\d\d\d)-(\d\d)-(\d\d).*/); - $bday{$user}{"AGE"} = ($year - $bday{$user}{"BDAY"}{"YEAR"}); - $bday{$user}{"TLEFT"} = Delta_Days($year, $month, $day, $year, $bday{$user}{"BDAY"}{"MONTH"}, $bday{$user}{"BDAY"}{"DAY"}); - } -} - -foreach $user (keys %bday) -{ - if ($bday{$user}{"TLEFT"}==7 || $bday{$user}{"TLEFT"}==-358) - { - &bdayMail($bday{$user}{"NAME"},$bday{$user}{"MAIL"},$bday{$user}{"AGE"},"Der Geburtstag von " . $bday{$user}{"NAME"} . " naht!", $bday{$user}{"BDAY"}{"DAY"} . "." . $bday{$user}{"BDAY"}{"MONTH"}); - } - if ($bday{$user}{"TLEFT"}==0) - { - &bdayMail($bday{$user}{"NAME"},$bday{$user}{"MAIL"},$bday{$user}{"AGE"},"Heute hat " . $bday{$user}{"NAME"} . " Geburtstag!", $bday{$user}{"BDAY"}{"DAY"} . "." . $bday{$user}{"BDAY"}{"MONTH"}); - } -} - -system("rm /tmp/birthday.tmp"); - -sub bdayMail { - $smtp = Net::SMTP->new('localhost') - or die "Can't connect SMTP localhost!\n"; - - $recp{'post@gunnarwrobel.de'}{"NAME"} = "Gunnar"; - - $date = sprintf("%.3s, %02d %.3s %d %d:%d:%d +0200", - Day_of_Week_to_Text(Day_of_Week($year,$month,$day)), - $day, - Month_to_Text($month), - $year,$hour,$min,$sec); - - foreach $localname (keys %recp) - { - $mail = 'From: Birthday Skript <system@gunnarwrobel.de>' . "\n"; - $mail .= "To: " . $recp{$localname}{"NAME"} . " <" . $localname .">\n"; - $mail .= "Date: " . $date . "\n"; - $mail .= "Subject: " . $_[3] . "\n\n"; - $mail .= "Am " . $_[4] . " wird " . $_[0] . " " . $_[2] . " Jahre alt.\n\n"; - if (!$_[1] eq "") - { - $mail .= "Falls Du eine Mail schreiben moechtest: " . $_[1] . "\n"; - } - $smtp->mail('system@gunnarwrobel.de'); - $smtp->to($localname); - $smtp->data(); - $smtp->datasend($mail); - $smtp->dataend(); - $smtp->quit; - } -} diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/check-ALLWRITE b/app-misc/scripts-gw/files/scripts-gw-1.0/check-ALLWRITE deleted file mode 100755 index ac2691b..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/check-ALLWRITE +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -LOG=/root/.log/read.log -LOG_OLD=/root/.log/read.log.old -mv $LOG $LOG_OLD -find / -xdev -perm +o=w ! \( -type d -perm +o=t \) ! -type l -print > $LOG - -diff -Nau $LOG_OLD $LOG -echo "##################################################" -cat $LOG_OLD -echo "##################################################" -cat $LOG -rm $LOG_OLD diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/check-SUID b/app-misc/scripts-gw/files/scripts-gw-1.0/check-SUID deleted file mode 100755 index 5740da4..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/check-SUID +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -LOG=/root/.log/suid.log -LOG_OLD=/root/.log/suid.log.old -mv $LOG $LOG_OLD -find / -xdev -type f -perm +ug=s -print > $LOG - -diff -Nau $LOG_OLD $LOG -echo "##################################################" -cat $LOG_OLD -echo "##################################################" -cat $LOG -rm $LOG_OLD diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/dailyRoutine b/app-misc/scripts-gw/files/scripts-gw-1.0/dailyRoutine deleted file mode 100755 index cc163e2..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/dailyRoutine +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -MYSQLPASS="$1" -GPGUSER="$2" -BACKUP="/root/opt/backup" - -echo "---------------------" -echo "-- TIME CORRECTION " -echo "---------------------" -echo - -ntpd -q - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "NOW:" -echo -date -echo "---------------------" -echo - -echo "---------------------" -echo "-- BACKUP " -echo "---------------------" -echo - -SVN-etc ${BACKUP} "AutomaticUpdate" -SVN-html ${BACKUP} "AutomaticUpdate" -SVN-mysql ${BACKUP} ${MYSQLPASS} "AutomaticUpdate" -SVN-ldap ${BACKUP} "AutomaticUpdate" - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- SVN BACKUP " -echo "---------------------" -echo - -SVN-daily ${GPGUSER} | grep -v "skipping" - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- APACHE STATS" -echo "---------------------" -echo - -/etc/analog/analog.daily - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- MAIL" -echo "---------------------" -echo - -rsync -rtpvz --delete-after /var/spool/mail/ /home/wrobel/mail/backup/ -chown -R wrobel:users /home/wrobel/mail/backup - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- GENERAL" -echo "---------------------" -echo - -slocate -u -texpire -check-SUID -check-ALLWRITE -horde.fetchmail -emerge --nospinner sync >> /var/log/portage.log -emerge --nospinner --pretend world -birthDay -logwatch.pl --detail 10 -logrotate /etc/logrotate.conf - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "NOW:" -echo -date -echo "---------------------" -echo diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/emerge-single b/app-misc/scripts-gw/files/scripts-gw-1.0/emerge-single deleted file mode 100755 index aa41c12..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/emerge-single +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -X=`/usr/bin/emerge -p $1 | /bin/grep '^\[' | /bin/wc | /bin/awk '{print $1}'` - -/usr/bin/test $X -eq 1 && emerge $1 && exit 0 - -echo $'\e[31;01m'"This would emerge more than one ebuild!" - -exit 1 diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/mysql-dump-all b/app-misc/scripts-gw/files/scripts-gw-1.0/mysql-dump-all deleted file mode 100755 index 6cbf58c..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/mysql-dump-all +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: mysql-dump-all mysql-root-pass /backup/dir" - echo - echo "Dumps all mysql databases into the given /backup/dir/" - exit 0 -fi - -DBS=`mysql -u root -p${1} -s -e 'show databases;' | grep -v 'Database'` - -for db in $DBS -do - mysqldump -u root -p${1} ${db} > ${2}/${db}.sql -done diff --git a/app-misc/scripts-gw/files/scripts-gw-1.0/tripUpdate b/app-misc/scripts-gw/files/scripts-gw-1.0/tripUpdate deleted file mode 100755 index 3eb69e8..0000000 --- a/app-misc/scripts-gw/files/scripts-gw-1.0/tripUpdate +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -DIR=/var/lib/tripwire/report -HOST=`hostname -s` -LAST_REPORT=`ls -1t $DIR/$HOST-*.twr | head -n 1` -tripwire --update --twrfile "$LAST_REPORT" diff --git a/app-misc/scripts-gw/files/tripUpdate b/app-misc/scripts-gw/files/tripUpdate deleted file mode 100755 index 3eb69e8..0000000 --- a/app-misc/scripts-gw/files/tripUpdate +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -DIR=/var/lib/tripwire/report -HOST=`hostname -s` -LAST_REPORT=`ls -1t $DIR/$HOST-*.twr | head -n 1` -tripwire --update --twrfile "$LAST_REPORT" |