aboutsummaryrefslogtreecommitdiffstats
path: root/jackoffall
diff options
context:
space:
mode:
authordvs12024-10-17 20:46:35 +1000
committerdvs12024-10-17 20:46:35 +1000
commit3ebed4e4f7cda7da2af3a63a80aeecbec45514db (patch)
treea6796438586e3637eca766679a46863282694021 /jackoffall
parentCorrect docs about where to put the aataaj.lua script (diff)
downloadJackOnAllDevices-3ebed4e4f7cda7da2af3a63a80aeecbec45514db.zip
JackOnAllDevices-3ebed4e4f7cda7da2af3a63a80aeecbec45514db.tar.gz
JackOnAllDevices-3ebed4e4f7cda7da2af3a63a80aeecbec45514db.tar.bz2
JackOnAllDevices-3ebed4e4f7cda7da2af3a63a80aeecbec45514db.tar.xz
Delete excess files, now I've combined them.
Diffstat (limited to '')
-rwxr-xr-xjackoffall146
1 files changed, 0 insertions, 146 deletions
diff --git a/jackoffall b/jackoffall
deleted file mode 100755
index 6c7cec2..0000000
--- a/jackoffall
+++ /dev/null
@@ -1,146 +0,0 @@
1#!/usr/bin/env luajit
2
3
4local APT = {}
5
6
7APT.readCmd = function(cmd)
8 local result = {}
9 local output = io.popen(cmd)
10 if nil ~= output then
11 for l in output:lines() do
12 table.insert(result, l)
13 end
14 end
15 return result
16end
17
18
19APT.exe = function(c)
20 local exe = {status = 0, result = '', log = true, cmd = c .. ' ', command = c}
21
22 function exe:log()
23 self.log = true
24 return self
25 end
26 function exe:Nice(c)
27 if nil == c then
28 self.cmd = 'ionice -c3 nice -n 19 ' .. self.cmd
29 else
30 self.cmd = self.cmd .. 'ionice -c3 nice -n 19 ' .. c .. ' '
31 end
32 return self
33 end
34 function exe:timeout(c)
35 -- timeout returns a status of - command status if --preserve-status; "128+9" (actually 137) if --kill-after ends up being done; 124 if it had to TERM; command status if all went well.
36 -- --kill-after means "send KILL after TERM fails.
37 if nil == c then
38 self.cmd = 'timeout --kill-after=10.0 --foreground 42.0s ' .. self.cmd
39 else
40 self.cmd = 'timeout --kill-after=10.0 --foreground ' .. c .. ' ' .. self.cmd
41 end
42 return self
43 end
44 function exe:also(c)
45 if nil == c then c = '' else c = ' ' .. c end
46 self.cmd = self.cmd .. ';' .. c .. ' '
47 return self
48 end
49 function exe:And(c)
50 if nil == c then c = '' else c = ' ' .. c end
51 self.cmd = self.cmd .. '&&' .. c .. ' '
52 return self
53 end
54 function exe:Or(c)
55 if nil == c then c = '' end
56 self.cmd = self.cmd .. '|| ' .. c .. ' '
57 return self
58 end
59 function exe:noErr()
60 self.cmd = self.cmd .. '2>/dev/null '
61 return self
62 end
63 function exe:wait(w)
64 self.cmd = self.cmd .. '&& touch ' .. w .. ' '
65 return self
66 end
67 function exe:Do()
68 --[[ "The condition expression of a control structure can return any
69 value. Both false and nil are considered false. All values different
70 from nil and false are considered true (in particular, the number 0
71 and the empty string are also true)."
72 says the docs, I beg to differ.]]
73 if true == self.log then D(" executing - &nbsp; <code>" .. self.cmd .. "</code>") end
74 --[[ Damn os.execute()
75 Lua 5.1 says it returns "a status code, which is system-dependent"
76 Lua 5.2 says it returns true/nil, "exit"/"signal", the status code.
77 I'm getting 7168 or 0. No idea what the fuck that is.
78 local ok, rslt, status = os.execute(s)
79 ]]
80 local f = APT.readCmd(self.cmd, 'r')
81 -- The last line will be the command's returned status, collect everything else in result.
82 self.status = '' -- Otherwise the result starts with 0.
83 self.result = '\n'
84 for i,l in ipairs(f) do
85 self.result = self.result .. l .. "\n"
86 end
87 f = APT.readCmd('echo "$?"', 'r')
88 for i,l in ipairs(f) do
89 self.status = tonumber(l)
90 if (137 == self.status) or (124 == self.status) then
91 print("timeout killed " .. self.status .. ' ' .. self.command)
92 E("timeout killed " .. self.status .. ' ' .. self.command)
93 elseif (0 ~= self.status) then
94 print("status |" .. self.status .. '| ' .. self.command)
95 E("status |" .. self.status .. '| ' .. self.command)
96 end
97 end
98 return self
99 end
100 function exe:fork(host)
101 if nil ~= host then self.cmd = self.cmd .. '; r=$?; if [ $r -ge 124 ]; then echo "$r ' .. host .. ' failed forked command ' .. string.gsub(self.cmd, '"', "'") .. '"; fi' end
102 self.cmd = '{ ' .. self.cmd .. '; } &'
103 if true == self.log then D(" forking - &nbsp; <code>" .. self.cmd .. "</code>") end
104 os.execute(self.cmd)
105 return self
106 end
107 return exe
108end
109
110
111APT.exe("a2j_control --stop"):Do()
112APT.exe("sleep 2"):Do()
113APT.exe("a2j_control --exit"):Do()
114APT.exe("sleep 2"):Do()
115APT.exe("killall -TERM alsa_out"):Do()
116APT.exe("killall -TERM alsa_in"):Do()
117APT.exe("killall -TERM zita-a2j"):Do()
118APT.exe("killall -TERM zita-j2a"):Do()
119APT.exe("killall -TERM aseqjoy"):Do()
120APT.exe("killall -TERM jack-plumbing"):Do()
121APT.exe("sleep 2"):Do()
122APT.exe("jack_control stop"):Do()
123APT.exe("sleep 2"):Do()
124APT.exe("jack_control exit"):Do()
125APT.exe("sleep 2"):Do()
126--APT.exe("a2j_control --stop; a2j_control --exit"):Do()
127--APT.exe("sleep 2"):Do()
128APT.exe("killall -TERM jmcore"):Do()
129APT.exe("pkill -TERM jackdbus; pkill -TERM a2jmidid"):Do()
130APT.exe("killall -TERM a2jmidid"):Do()
131APT.exe("killall -KILL jackdbus"):Do()
132APT.exe("sleep 2"):Do()
133APT.exe("killall -KILL a2jmidid"):Do()
134APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do()
135APT.exe("sleep 2"):Do()
136APT.exe("killall -KILL a2jmidid"):Do()
137APT.exe("killall -KILL jackdbus"):Do()
138APT.exe("sleep 2"):Do()
139APT.exe("killall -KILL a2jmidid"):Do()
140APT.exe("killall -KILL jackdbus"):Do()
141APT.exe("sleep 2"):Do()
142APT.exe("pkill -KILL jackdbus; pkill -KILL a2jmidid"):Do()
143APT.exe("killall -TERM qjackctl"):Do()
144
145-- Catia is python, and no easy way to kill it.
146APT.exe("ps auxw | grep python"):Do()