Mailinglist Archive: opensuse (1523 mails)
| < Previous | Next > |
Re: [opensuse] I have a small script to run several programs - pidgin, thunderbird, skype - by one click. How can I close them by one click?
- From: David Haller <dnh@xxxxxxxxxxxx>
- Date: Sun, 21 Mar 2010 03:35:53 +0100
- Message-id: <20100321023553.GB5838@xxxxxxxxxxxxxxxxxx>
Hello,
On Sun, 21 Mar 2010, arygroup@xxxxxxxxx wrote:
==== some ideas, UNTESTED ====
#!/bin/bash
PROGS=( "pidgin" \
"skype" \
"alltray thunderbird" \
"dropbox start -i" \
)
pids_to_kill=()
killem() {
sig=$1; shift;
for pid in ${pids_to_kill[@]}; do
kill "-$sig" $pid
done
exit $sig
}
trap "killem HUP" HUP
trap "killem INT" INT
trap "killem USR1" USR1
trap "killem TERM" TERM EXIT
for prog in "${PROGS[@]}"; do
$prog &
pids_to_kill=( ${pids_to_kill[@]} $! )
done
wait
====
HTH,
-dnh
--
No trees were destroyed in the sending of this message, however, a
significant number of electrons were terribly inconvenienced.
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
On Sun, 21 Mar 2010, arygroup@xxxxxxxxx wrote:
My script is
#/bin/bash
pidgin&
skype&
alltray thunderbird&
dropbox start -i &
==== some ideas, UNTESTED ====
#!/bin/bash
PROGS=( "pidgin" \
"skype" \
"alltray thunderbird" \
"dropbox start -i" \
)
pids_to_kill=()
killem() {
sig=$1; shift;
for pid in ${pids_to_kill[@]}; do
kill "-$sig" $pid
done
exit $sig
}
trap "killem HUP" HUP
trap "killem INT" INT
trap "killem USR1" USR1
trap "killem TERM" TERM EXIT
for prog in "${PROGS[@]}"; do
$prog &
pids_to_kill=( ${pids_to_kill[@]} $! )
done
wait
====
HTH,
-dnh
--
No trees were destroyed in the sending of this message, however, a
significant number of electrons were terribly inconvenienced.
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |