You are not logged in.

#1 2012-08-26 22:59:05

RobertBuhren
Member
Registered: 2011-09-05
Posts: 59

Zenity --progress --auto-kill usage?

Hello,

i'm trying to built a simple backup script which launches rsync and zenity:

#/bin/bash
rsync -auvh --progress --delete  / /mnt/BACKUP | zenity --progress --auto-kill

What i want to archive is that if i press the "cancel" button of the zenity progress bar, the rsync process should be killed. What happens instead is that my bash is killed.
Is there any nice way of how i can kill the rsync process when i press the "cancel" button?

Thanks in advance,

Robert

Offline

#2 2012-08-30 22:48:01

VCoolio
Member
From: Netherlands
Registered: 2010-01-05
Posts: 118

Re: Zenity --progress --auto-kill usage?

check exit code?

#/bin/bash
rsync -auvh --progress --delete  / /mnt/BACKUP | zenity --progress --auto-kill
if [ $? = 1 ]; then
    echo you pressed cancel
    killall rsync
else
    echo you did not press cancel
fi

Offline

Board footer

Powered by FluxBB