
ray wrote:@damNageHack,
The pgrep line you wrote wouldnt work if there's more than one instance of zenity around, would it?
Anyways, i'll have a shot at it tomorrow, it's getting a bit late.
Cheers,
ray
if [[ `LANG=C /usr/sbin/slapt-get -s --upgrade | grep "Need to get"` ]]
then
if [ -n "$TRAYPID" ]; then
kill "$TRAYPID" >/dev/null 2>&1
sleep 5s
kill -9 "$TRAYPID" >/dev/null 2>&1
fi
zenity --notification \
--text="`eval_gettext 'Package updates are available.'`" \
--window-icon=/usr/share/pixmaps/salix-update-notifier.png \
TRAYPID=$!
ret=$?
if [ $ret ]; then
zenity --question \
--title "`eval_gettext 'Install package updates?'`" \
--text="`eval_gettext 'Package updates are available for your system.\n\nSelecting OK will perform the updates using gslapt. Root user privileges will be required in order to do that.\n\nProceed with updating?'`" \
--window-icon=/usr/share/pixmaps/salix-update-notifier.png \
&& $SUCOMMAND gslapt --upgrade
fi
fi
Shador wrote:You could capture other instances of zenity, which weren't launched by you. Then you would kill a process which you mustn't kill.
damNageHack wrote:Sorry, but I doubt that I understand your problem.man pgrep wrote: pgrep looks through the currently running processes and lists the pro-
cess IDs which matches the selection criteria to stdout. All the cri-
teria have to match. For example,
[...]
-f The pattern is normally only matched against the process name.
When -f is set, the full command line is used.ray wrote:The pgrep line you wrote wouldnt work if there's more than one instance of zenity around, would it?
Do you see the pattern "zenity.+salix" in my code? And now, think again. I doubt that there will be more than one process with a command line that matches a pattern with "salix" in it, and you can see from the original script that the call to zenity uses a special "salix" icon file, so the pattern should be unique enough.

damNageHack wrote:Shador wrote:You could capture other instances of zenity, which weren't launched by you. Then you would kill a process which you mustn't kill.
I do not want to be impolite, but the answer to that was already there.damNageHack wrote:Sorry, but I doubt that I understand your problem.man pgrep wrote: pgrep looks through the currently running processes and lists the pro-
cess IDs which matches the selection criteria to stdout. All the cri-
teria have to match. For example,
[...]
-f The pattern is normally only matched against the process name.
When -f is set, the full command line is used.ray wrote:The pgrep line you wrote wouldnt work if there's more than one instance of zenity around, would it?
Do you see the pattern "zenity.+salix" in my code? And now, think again. I doubt that there will be more than one process with a command line that matches a pattern with "salix" in it, and you can see from the original script that the call to zenity uses a special "salix" icon file, so the pattern should be unique enough.