Alright, first of all: I don't know anything of perl at all, but I gave it a shot, and I have now my url-, email- and links database emailed to me, via the links manager.
I hope this works for you too. You can copy the code here (
www.peng.nl/backup_pl.txt ) or copy it from this page.
Let me know if I've done stupid things!
If you like it, let me know as well. (it's my very first attempt).
Lex.
------------------------------------------
#!/usr/bin/perl
#
#
# ** File Backupper 1 **
# by Lex Thoonen
# Lex@peng.nl
# http://www.peng.nl
#
# (if you wonder why 'peng', it's all explained at the website)
#
# Okay, here we go, this is my first attempt ever with perl...
# But hey, it worked at my site!
# I've put this file in my (protected) 'admin' directory
# and I think, if you have 'links' normally installed, you
# probably won't have to change the filenames and paths.
# but check them anyway.
#
# Save this file as 'backup.pl' at your admin directory (links)
# Replace the emailto and emailfrom and mailprog if necessary
#
# I'm sorry if I can't give you more options here, to be honest,
# I just don't know anything of perl.
# You probably know as much as I do (or more)
#
# By the way, this 'program' backups the links database, email and url.
#
# If you improve or alter this, please let me know!
# I could probably do with it myself...
#
# p.s. Thanks to everybody who ever put their code available
# (for me to look at)
#
# To make this backupper available from your 'links administration menu'
# it's easiest to open up 'admin_html.pl' and add the following lines
# at 'sub html_navigation' (I've put it as the last one)
#
# <p><$font><b>Back Up by Email</b><br></font>
# <$font>
# <a href="backup.pl">Send now</a><br>
# </font>
#
#
$file1 = "data/email.db";
$file2 = "data/links.db";
$file3 = "data/url.db";
$emailto = "lex\@peng.nl"; # leave the '\' in front of the '@'!
$emailfrom = "backupper\@yoursite.com";
$mailprog = "/usr/bin/sendmail";
#
#
print "Content-type: text/plain\n\n";
print "So, \n\nyou wanted a back up right?...\ncoming!\n\n";
open(emaillist, "$file1");
@entries1 = <emaillist>;
open(linkslist, "$file2");
@entries2 = <linkslist>;
open(urllist, "$file3");
@entries3 = <urllist>;
open(MAIL,"|$mailprog -t");
print MAIL "To: $emailto\n";
print MAIL "From: $emailfrom\n";
print MAIL "Subject: backup of $file1, $file2 and $file3";
print MAIL "\n\n\nHi,\n\nYour backups of today:...\n\n";
print MAIL "**************************************\n\n$file1\n\n";
print MAIL "\n\n";
foreach $line (@entries1) {
print MAIL "$line";
}
print MAIL "\n\n";
print MAIL "**************************************\n\n$file2\n\n";
print MAIL "\n\n";
foreach $line (@entries2) {
print MAIL "$line";
}
print MAIL "\n\n";
print MAIL "**************************************\n\n$file3\n\n";
print MAIL "\n\n";
foreach $line (@entries3) {
print MAIL "$line";
}
print MAIL "\n\n**************************************\n\n";
print MAIL "And now be careful with them!\n\nLex.\n(lex\@peng.nl)";
close (MAIL);
close emaillist;
close linkslist;
close urllist;
#
#
print "***************************************\n\nReady! \n\nYou should have: \n\n$file1, \n$file2 and \n$file3 \n\nat your mailbox. \n\nIt all has been sent to: $emailto ";
print "\n\nLex.\n(comments: lex\@peng.nl)";
####################
That was it!
[This message has been edited by Lex (edited December 12, 1999).]