Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Portage Update Script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
flow666
n00b
n00b


Joined: 01 Jul 2003
Posts: 74
Location: Diepholz

PostPosted: Wed Sep 29, 2004 7:53 pm    Post subject: Portage Update Script Reply with quote

Hi,

I've written a little Script, which updates the portage tree, looks for which packages needs to be upgraded and mails that to root. If you put it in /etc/cron.daily/ you'll have it executed every night.

Perhaps anybody has use for it.

Code:

#!/bin/sh

function emerge_sync {
 emerge sync &>/dev/null && echo "Portage Tree synced."
 emerge -upDv world | sed -e "s|dependencies.*\.\.\.|dependencies \.\.\.|g"
 sleep 15s
 echo "Done!"
}

senddate=$(date +"%d.%m.%Y %T")
emerge_sync | mail -s "Nightly Portage Update ($senddate)" user@host.de

exit 0


flow
_________________
Ringwald's Gesetz der Haushaltsgeometrie:
"Alle horizontalen Flächen werden in kurzer Zeit mit Gerümpel bedeckt."
Back to top
View user's profile Send private message
Maradine
n00b
n00b


Joined: 30 Sep 2004
Posts: 1

PostPosted: Fri Oct 15, 2004 8:54 pm    Post subject: Most useful! Reply with quote

I appreciate your efforts; it's exactly what I was looking for today. I modified it slightly to work with ssmtp, which seems to be installed on every Gentoo box by default:

Code:

#!/bin/sh

function emerge_sync {
 emerge sync &>/dev/null && echo "Portage Tree synced."
 emerge -upDv world | sed -e "s|dependencies.*\.\.\.|dependencies \.\.\.|g"
 sleep 15s
 echo "Done!"
}

senddate=$(date +"%d.%m.%Y %T")
echo "Subject: Cyanide Nightly Sync ($senddate)" > /usr/local/scripts/nstemp
emerge_sync >> /usr/local/scripts/nstemp
cat /usr/local/scripts/nstemp | ssmtp me@here.com

exit 0


Thanks again!

M
Back to top
View user's profile Send private message
gungholady
Guru
Guru


Joined: 19 Oct 2003
Posts: 392

PostPosted: Mon Oct 18, 2004 8:45 pm    Post subject: Reply with quote

What do you have installed that provides the mail command? I have postfix installed and working for local messages. When I tried your script, I got the message mail: command not found.
Back to top
View user's profile Send private message
flow666
n00b
n00b


Joined: 01 Jul 2003
Posts: 74
Location: Diepholz

PostPosted: Mon Oct 18, 2004 10:11 pm    Post subject: Reply with quote

You need mailx, i think.

Code:
emerge mailx

_________________
Ringwald's Gesetz der Haushaltsgeometrie:
"Alle horizontalen Flächen werden in kurzer Zeit mit Gerümpel bedeckt."
Back to top
View user's profile Send private message
gungholady
Guru
Guru


Joined: 19 Oct 2003
Posts: 392

PostPosted: Tue Oct 19, 2004 9:41 am    Post subject: Reply with quote

Thanks. I got it working. Your script helps to save me some time.
Back to top
View user's profile Send private message
Trevoke
Advocate
Advocate


Joined: 04 Sep 2004
Posts: 4099
Location: NY, NY

PostPosted: Tue Oct 19, 2004 1:18 pm    Post subject: Reply with quote

Ok... I know next to nothing about shell scripting..

But I would like to know if, in the interest of servers or production boxes or whatnot, it would be possible to modify this so it only checks for updates of specific packages (for instance a list it finds in a text file somewhere..)

I feel that if you have the time to write that, it could become a _very_ handy little tool :)
_________________
Votre moment detente
What is the nature of conflict?
Back to top
View user's profile Send private message
dkure
n00b
n00b


Joined: 20 Apr 2004
Posts: 51
Location: Sydney, Australia

PostPosted: Tue Oct 19, 2004 1:53 pm    Post subject: Reply with quote

it certainly is possible to modify it

all you need to do is create a text file

place all the files that you wish to use have checked
it would look like this
Code:
net-im/gaim
net-www/apache
sys-apps/portage


then instead of
Code:
 emerge -upDv world | sed -e "s|dependencies.*\.\.\.|dependencies

you would use this
Code:
 emerge -upDv < path_to_file | sed -e "s|dependencies.*\.\.\.|dependencies
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
Page 1 of 1

 
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