Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
System updater, automagically keep your system up to date!
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Bouncelot
n00b
n00b


Joined: 09 Sep 2003
Posts: 56

PostPosted: Wed Oct 08, 2003 5:35 pm    Post subject: My little contribution. Reply with quote

Here is the script I have been using. I prefer to update manualy especialy on my servers ;)

I set it up as a weekly cron to notify me of updates.

Code:
#!/usr/bin/perl

use Net::SMTP;

my $mailserver = "mail";
my $sysadmin  = "root\@bouncelot.com";
my $message  = "";
$bUpdates = 0;


#Update the package tree.
`emerge sync > /dev/null`;

$message = "System Updates: \n";
$_ = `emerge -up system`;
$message .= checkForUpdates($_);

$message .= "\nWorld Updates: \n";
$_ = `emerge -up world`;
$message .= checkForUpdates($_);

$message .= "\nKernel Updates: \n";
$_ = `emerge -p gentoo-sources`;
$message .= checkForUpdates($_);

if($bUpdates == 1) {
   sendStatus($mailserver, $sysadmin, $message);
}

exit 0;

sub checkForUpdates
{
   my $message = "";
   /^\n+(.*):\n+(.*)!\n+(.*)\n+$/;
   if($3 ne "") {
      $message = "$3\n";
      $bUpdates = 1;
   }
   else {
      $message = "None.\n";
   }
return $message;
}

sub sendStatus
{
   my $hostname = `hostname -f`;
   my $smtp = Net::SMTP->new($_[0]);

   $smtp->mail($ENV{USER});
   $smtp->to($_[1]);

   $smtp->data();
   $smtp->datasend("To: $_[1]\n");
   $smtp->datasend("From: $ENV{USER}\n");
   $smtp->datasend("Subject: $hostname System Update\n");
   $smtp->datasend("\n");
   $smtp->datasend($_[2]);
   $smtp->dataend();

   $smtp->quit;
}
Back to top
View user's profile Send private message
s0m3body
n00b
n00b


Joined: 16 Nov 2003
Posts: 11

PostPosted: Thu Dec 11, 2003 12:27 pm    Post subject: syncing multiple machines Reply with quote

i'm sorry if there is an answer somewhere in the documetnation - i haven't found it

i have several servers running gentoo, doing emerge sync every couple of days
my question is - is it possible to change all of them but one to sync with my 'master' ?
then i need to sync master against rsync.gentoo.org and the rest of my servers against the master
not only that it reduces load on gentoo servers, it also reduces my internet traffic and saves me money

or shall i just run rsync command to sync /usr/portage instead of emerge sync (on 'slaves') ?

thanks,
martin
Back to top
View user's profile Send private message
Anior
Guru
Guru


Joined: 17 Apr 2003
Posts: 317
Location: European Union (Stockholm / Sweden)

PostPosted: Thu Dec 11, 2003 2:45 pm    Post subject: Reply with quote

Here is two nice guides for managing a lan of gentoo machines.
https://forums.gentoo.org/viewtopic.php?t=59134
https://forums.gentoo.org/viewtopic.php?t=35594
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum