aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvs12024-10-19 13:47:14 +1000
committerdvs12024-10-19 13:47:14 +1000
commit309c2eec6168eec24d98a09bfda3aa77497bf798 (patch)
tree7c74d42f35da31b741a82c7eae1299dec75fbcf9
parentAdd how_it_works. (diff)
downloadJackOnAllDevices-309c2eec6168eec24d98a09bfda3aa77497bf798.zip
JackOnAllDevices-309c2eec6168eec24d98a09bfda3aa77497bf798.tar.gz
JackOnAllDevices-309c2eec6168eec24d98a09bfda3aa77497bf798.tar.bz2
JackOnAllDevices-309c2eec6168eec24d98a09bfda3aa77497bf798.tar.xz
Make stop less crude.
-rw-r--r--README.md2
-rwxr-xr-xaataaj.lua49
-rw-r--r--how_it_works.md2
3 files changed, 24 insertions, 29 deletions
diff --git a/README.md b/README.md
index 47d1ba7..e645276 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ joysticks it finds as MIDI controllers. So any ALSA application gets routed thr
7JACK. 7JACK.
8 8
9This is very rough for now, only just started writing it. The stop 9This is very rough for now, only just started writing it. The stop
10command is particularly crude and violent, lots of killall. 10command is particularly crude and violent, lots of pkill.
11 11
12Since it isn't a package yet, some setup is needed. 12Since it isn't a package yet, some setup is needed.
13 13
diff --git a/aataaj.lua b/aataaj.lua
index 6315982..44ccd5d 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -24,7 +24,7 @@ joysticks it finds as MIDI controllers. So any ALSA application gets routed thr
24JACK. 24JACK.
25 25
26This is very rough for now, only just started writing it. The stop 26This is very rough for now, only just started writing it. The stop
27command is particularly crude and violent, lots of killall. 27command is particularly crude and violent, lots of pkill.
28 28
29Since it isn't a package yet, some setup is needed. 29Since it isn't a package yet, some setup is needed.
30 30
@@ -190,6 +190,19 @@ APT.exe = function(c)
190 return exe 190 return exe
191end 191end
192 192
193APT.killEmAll = function(all)
194 for i,l in ipairs(all) do
195 local c = 0
196 while 0 ~= tonumber(APT.exe("pgrep -u $USER -xc " .. l):Do().result) do
197 local s = 'TERM'
198 if c > 0 then s = 'KILL' end
199 print( "pkill -" .. s .. " -u $USER -x " .. l)
200 APT.exe("pkill -" .. s .. " -u $USER -x " .. l):Do()
201 c = c + 1
202 end
203 end
204end
205
193 206
194 207
195local args = {...} 208local args = {...}
@@ -200,17 +213,12 @@ if 0 ~= #args then
200 213
201 if 'start' == args[1] then 214 if 'start' == args[1] then
202 elseif 'stop' == args[1] then 215 elseif 'stop' == args[1] then
203 APT.exe("killall -TERM qsynth"):Do() 216 APT.killEmAll{'qsynth'}
204 APT.exe("a2j_control --stop"):Do() 217 APT.exe("a2j_control --stop"):Do()
205 APT.exe("sleep 2"):Do() 218 APT.exe("sleep 2"):Do()
206 APT.exe("a2j_control --exit"):Do() 219 APT.exe("a2j_control --exit"):Do()
207 APT.exe("sleep 2"):Do() 220 APT.exe("sleep 2"):Do()
208 APT.exe("killall -TERM alsa_out"):Do() 221 APT.killEmAll{'alsa_in', 'alsa_out', 'zita-a2j', 'zita-j2a', 'aseqjoy', 'jack-plumbing'}
209 APT.exe("killall -TERM alsa_in"):Do()
210 APT.exe("killall -TERM zita-a2j"):Do()
211 APT.exe("killall -TERM zita-j2a"):Do()
212 APT.exe("killall -TERM aseqjoy"):Do()
213 APT.exe("killall -TERM jack-plumbing"):Do()
214 APT.exe("sleep 2"):Do() 222 APT.exe("sleep 2"):Do()
215 APT.exe("jack_control stop"):Do() 223 APT.exe("jack_control stop"):Do()
216 APT.exe("sleep 2"):Do() 224 APT.exe("sleep 2"):Do()
@@ -218,25 +226,12 @@ if 0 ~= #args then
218 APT.exe("sleep 2"):Do() 226 APT.exe("sleep 2"):Do()
219 --APT.exe("a2j_control --stop; a2j_control --exit"):Do() 227 --APT.exe("a2j_control --stop; a2j_control --exit"):Do()
220 --APT.exe("sleep 2"):Do() 228 --APT.exe("sleep 2"):Do()
221 APT.exe("killall -TERM jmcore"):Do() 229 APT.killEmAll{'jmcore', 'qjackctl'}
222 APT.exe("pkill -TERM jackdbus; pkill -TERM a2jmidid"):Do()
223 APT.exe("killall -TERM a2jmidid"):Do()
224 APT.exe("killall -KILL jackdbus"):Do()
225 APT.exe("sleep 2"):Do()
226 APT.exe("killall -KILL a2jmidid"):Do()
227 APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do()
228 APT.exe("sleep 2"):Do()
229 APT.exe("killall -KILL a2jmidid"):Do()
230 APT.exe("killall -KILL jackdbus"):Do()
231 APT.exe("sleep 2"):Do()
232 APT.exe("killall -KILL a2jmidid"):Do()
233 APT.exe("killall -KILL jackdbus"):Do()
234 APT.exe("sleep 2"):Do()
235 APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do()
236 APT.exe("killall -TERM qjackctl"):Do()
237
238 -- Catia is python, and no easy way to kill it. 230 -- Catia is python, and no easy way to kill it.
239 APT.exe("ps auxw | grep python"):Do() 231 -- Also it keeps jackdbus alive, no matter how hard you kill it.
232 APT.exe("pkill -TERM -u $USER -f catia"):Do()
233 APT.exe("sleep 2"):Do()
234 APT.killEmAll{'jackdbus', 'a2jmidid'}
240 return(0) 235 return(0)
241 elseif 'JACK' == args[1] then 236 elseif 'JACK' == args[1] then
242 elseif 'restart' == args[1] then args[1] = 'start' 237 elseif 'restart' == args[1] then args[1] = 'start'
@@ -564,5 +559,5 @@ elseif 'JACK' == args[1] then
564 559
565 print('Stop our jack-plumbing, eventually.') 560 print('Stop our jack-plumbing, eventually.')
566 APT.exe('sleep 4'):Do() 561 APT.exe('sleep 4'):Do()
567 APT.exe("killall -TERM jack-plumbing"):Do() 562 APT.killEmAll("jack-plumbing"):Do()
568end 563end
diff --git a/how_it_works.md b/how_it_works.md
index 606ecdf..847e06a 100644
--- a/how_it_works.md
+++ b/how_it_works.md
@@ -44,7 +44,7 @@ Then comes the argument handling. Handles the usual init script
44arguments, plus a couple more. Some are just aliases for "start", for 44arguments, plus a couple more. Some are just aliases for "start", for
45now. 45now.
46 46
47"stop" is very crude and violent, mostly just killall. 47"stop" is very crude and violent, mostly just pkill.
48 48
49 49
50A short bit where you can change some options. 50A short bit where you can change some options.