RE: bash script using dialog
- From: "Billy Verreynne \(JW\)" <VerreyB@xxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 14:04:33 +0200
--- Begin Message ---Thomas Beckett wrote:
- From: "Billy Verreynne \(JW\)" <VerreyB@xxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 14:04:33 +0200
> I want the script to start the compilation but carry on when it is
> finished whithout the user having to press <Exit>. Do you have any
> suggestions how I can compile the program and inform the user that
> this is happening
Tom, I quikcly wrote the following (very basic) sample script of how
to spawn a background job and then display an interactive progress
bar.
==
#!/bin/sh
# example of displaying a progress bar, waiting for a process to
complete
# create a shell script to run in the background (this one simply
sleeps
# for n seconds and then exits)
BGJOB=/tmp/~$$.sh
echo "#!/bin/sh
sleep 20
exit 0" > $BGJOB
# start background process
sh $BGJOB &
# get the process id of the background process
CPID=`jobs -p`
# monitor process
EC=0
i=0
while ( [ $EC -eq 0 ] )
do
# is the process still running?
# (is there less of a hack to do it than the following?)
EC=`ps -p $CPID 1>/dev/null 2>/dev/null;echo $?`
# we need to feed the process bar with data
let i++
echo $i
done | zenity --title "Waiting on Job" --progress --pulsate
--auto-close
echo "Job is done"
# cleanup
[ -f $BGJOB ] && rm $BGJOB
#eof
==
It should hopefully give you an idea of how to do it on your shell
script.
--
Billy
<<winmail.dat>>
--- End Message ---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This e-mail and its contents are subject to the Telkom SA Limited e-mail legal notice available at http://www.telkom.co.za/TelkomEMailLegalNotice.PDF ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ubuntu-users mailing list ubuntu-users@xxxxxxxxxxxxxxxx https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- Follow-Ups:
- Re: bash script using dialog
- From: Thomas Beckett
- Re: bash script using dialog
- Prev by Date: Re: broadcast adress assignement in GUI
- Next by Date: Re: making mldonkey handle bittorrent downloads
- Previous by thread: Re: bash script using dialog
- Next by thread: Re: bash script using dialog
- Index(es):
Relevant Pages
|