summaryrefslogtreecommitdiffstats
path: root/util/dailybackup.pl
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-07 23:13:44 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-07 23:13:44 +0800
commitae31e19f92e717919ac8e3db9039eb38d2b89aae (patch)
treec70164d6a1852344f44b04a653ae2815043512af /util/dailybackup.pl
downloadpttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.gz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.bz2
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.lz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.xz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.zst
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.zip
Initial revision
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/dailybackup.pl')
-rw-r--r--util/dailybackup.pl48
1 files changed, 48 insertions, 0 deletions
diff --git a/util/dailybackup.pl b/util/dailybackup.pl
new file mode 100644
index 00000000..76943887
--- /dev/null
+++ b/util/dailybackup.pl
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+use lib '/home/bbs/bin/';
+use LocalVars;
+use strict;
+use vars qw/$BACKHOME $MANROOT $HOMEROOT $BOARDROOT/;
+
+$BACKHOME = "$BBSHOME/backup";
+$MANROOT = "man/boards";
+$HOMEROOT = "home";
+$BOARDROOT= "boards";
+
+chdir $BBSHOME;
+my @baktable = (['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],
+ ['I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'],
+ ['Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X'],
+ ['Y', 'Z', 'a', 'b', 'c', 'd', 'e'],
+ ['f', 'g', 'h', 'i', 'j', 'k', 'l'],
+ ['m', 'n', 'o', 'p', 'q', 'r', 's'],
+ ['t', 'u', 'v', 'w', 'x', 'y', 'z']);
+my (undef,undef,undef,undef,undef,undef,$wday) = localtime(time);
+my $week = defined($ARGV[0]) ? $ARGV[0] : $wday;
+
+no strict 'subs';
+setpriority(PRIO_PROCESS, $$, 20);
+use strict subs;
+
+my($orig, $to);
+foreach $orig ( <$BACKHOME/*new*> ){
+ $to = $orig;
+ $to =~ s/\.new//g;
+ docmd("mv $orig $to");
+}
+
+foreach( @{$baktable[$week]} ){
+ docmd("$TAR zcf $BACKHOME/man.$_.new.tgz $MANROOT/$_*");
+ docmd("$TAR zcf $BACKHOME/home.$_.new.tgz $HOMEROOT/$_/*");
+ docmd("$TAR zcf $BACKHOME/board.$_.new.tgz $BOARDROOT/$_*");
+}
+
+if( $week == 0 ){
+ docmd("$TAR zcf $BACKHOME/general.new.tgz .act .crontab .note .polling .post bin cron etc innd note.ans note.dat out out.going pttbbs pttbbs.conf upgrade.sh usies ussong");
+}
+
+sub docmd
+{
+ print "@_\n";
+ `@_`;
+}