Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 03-08-2007, 06:48 AM   #1
Registered: Feb 2003
Location: London
Distribution: Fedora 22
Posts: 59

Rep: Reputation: 15
Question Automated build and email log in bash


I have a specific need for a script :

1. extract latest CVS
2. build the extracted snapshot (configure + make)
3. if successful, stop service, copy generated binary to a directory, restart service
4. mail me all output + time taken in each step (cvs retrieval, configure and make) + is service running

So far, I have 1 and 2 running :


# Automatic MLDonkey compilation from CVS
# Run as root in home directory

cvs -z9 co -P mldonkey
cd mldonkey
echo "MLDonkey build complete."
What is the best way to implement the remaining steps? Also, if I run this as a cron job, will I get two mails (from successful cronjob + script's own mail) ?

Thanks for any help!
Old 03-08-2007, 12:59 PM   #2
Registered: Feb 2003
Location: London
Distribution: Fedora 22
Posts: 59

Original Poster
Rep: Reputation: 15
Got it!


# Automated MLDonkey build script -

MESSAGE="step incomplete"

echo $MESSAGE > /tmp/cvs-update.log
echo $MESSAGE > /tmp/configure.log
echo $MESSAGE > /tmp/make.log

START='build started '`date +"%m-%d-%Y %T"`

if [ -e /root/mldonkey/mlnet ]; then
rm /root/mldonkey/mlnet

cd /root
cvs -z9 co -P mldonkey &> /tmp/cvs-update.log && cd mldonkey && ./configure &> /tmp/configure.log && make &> /tmp/make.log

END='build ended '`date +"%m-%d-%Y %T"`

EMAIL="your email here"

if [ -e /root/mldonkey/mlnet ]; then
        SUM=`md5sum /root/mldonkey/mlnet | cut -d " " -f1`;
        echo "$START

$END" | mutt -s "mldonkey build successful [$SUM]" $EMAIL -a /tmp/cvs-update.log -a /tmp/configure.log -a /tmp/make.log ;
        echo "$START

$END" | mutt -s "mldonkey build failed" $EMAIL -a /tmp/cvs-update.log -a /tmp/configure.log -a /tmp/make.log

rm /tmp/cvs-update.log
rm /tmp/configure.log
rm /tmp/make.log


bash, cron, cvs, mldonkey, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Build email offline on qmail and fetchmail vinhhv Linux - Networking 1 10-30-2006 04:08 AM
NVIDIA Mandriva LE 2005 Build Errors +log Damatie Mandriva 1 06-08-2005 02:58 PM
automated email list forwarding linuxhippy Slackware 9 05-22-2005 07:53 PM
chapter 5 - bash won't build shaurz Linux From Scratch 3 02-05-2003 05:00 AM
Glibc 2.3.1 build causes segfaults with static bash mdh Linux From Scratch 2 11-12-2002 07:08 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration