You are not logged in.

#1 2005-12-28 09:09:18

BroodingDogma
Member
Registered: 2005-03-31
Posts: 13

Sound upon script completion

I have a script that automates making and installing packages from the AUR.  Is there a way to make it play a sound or give me a pop in X when it is finished?

The script is iphitus'  and is as follows:
#! /bin/bash

# AUR Package installation script
# run as:
# aur

# James Rayner < iphitus@gmail.com >

. /etc/rc.d/functions

stat_busy "Downloading PKGBUILDs" 
wget -q http://aur.archlinux.org/packages/$1/$1.tar.gz

if [[ $? -eq 0 ]];
then
    stat_done
    status "Extracting PKGBUILD" tar -zxvf $1.tar.gz
    rm $1.tar.gz &> /dev/null
    cd $1
    if [[ $UID = 0 ]]; then
        stat_busy "Making Package"
        exec makepkg -fi 
    else
        stat_busy "Making Package"
        exec makepkg -f
    fi
else
    stat_fail
    echo "  Package Unavailable"
fi


I know it's not a necesary thing, but when the comp is working on a particularly long project I tend to wander off and do something else.  It would be convenient to not have to look over every couple of minutes to see if it's done yet.
Thanks.

Offline

#2 2005-12-28 18:44:57

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: Sound upon script completion

You can use the WAIT command to wait for all background processes in your script to finish before performing an action.

So you'd have e.g.

[your script]
wait
player sound.mp3


I don't know how to easily do a popup in X, but to play you'll have to specify a player and a soundfile. If you don't want to play the sound in your default music player (since it's a bit of an arse having Amarok/XMMS/MPD stop playing music just to beep at you wink) then personally I'd advise using sox - it's a tiny CLI player, great for sounds like this. You'd then just do sox soundfile.mp3, and soxmixer lets you change settings

Hope that helps.

Komodo


.oO Komodo Dave Oo.

Offline

#3 2005-12-29 08:07:43

BroodingDogma
Member
Registered: 2005-03-31
Posts: 13

Re: Sound upon script completion

Thanks for the help

Offline

#4 2005-12-29 10:04:52

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: Sound upon script completion

No problem mate wink


.oO Komodo Dave Oo.

Offline

Board footer

Powered by FluxBB