aboutsummaryrefslogtreecommitdiffstats
path: root/test_.lua
diff options
context:
space:
mode:
authordvs12024-10-21 18:55:20 +1000
committerdvs12024-10-21 18:55:20 +1000
commit0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05 (patch)
tree61f4f3b2197a7ae36c2dc064fc9f9c55a292430b /test_.lua
parentTweak the "didn't die" sleep. (diff)
downloadJackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.zip
JackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.tar.gz
JackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.tar.bz2
JackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.tar.xz
Restructure the APT.exe stuff.
Diffstat (limited to '')
-rwxr-xr-xtest_.lua122
1 files changed, 122 insertions, 0 deletions
diff --git a/test_.lua b/test_.lua
new file mode 100755
index 0000000..4d0e723
--- /dev/null
+++ b/test_.lua
@@ -0,0 +1,122 @@
1#!/usr/bin/env luajit
2
3
4local _ = require '_'
5local D = _.D
6local I = _.I
7local T = _.T
8local W = _.W
9local E = _.E
10local C = _.C
11local __ = _._
12
13
14D('Starting from the top.')
15
16local Help = [[
17This is part of the blah blah blah...
18]]
19
20
21
22local args = {...}
23if 0 ~= #args then
24-- for i,a in pairs(args) do
25-- print('Argument ' .. i .. ' = ' .. a)
26-- end
27
28 if 'start' == args[1] then
29 elseif 'stop' == args[1] then
30--[=[
31 _.killEmAll{'qsynth'}
32 __[[
33a2j_control --stop
34sleep 2
35a2j_control --exit
36sleep 2
37]]:Do()
38 _.killEmAll{'alsa_in', 'alsa_out', 'zita-a2j', 'zita-j2a', 'aseqjoy', 'jack-plumbing'}
39 __[[
40sleep 2
41jack_control stop
42sleep 2
43jack_control exit
44sleep 2
45]]:Do()
46 _.killEmAll{'jmcore', 'qjackctl'}
47 -- Catia is python, and no easy way to kill it.
48 -- Also it keeps jackdbus alive, no matter how hard you kill it.
49 __"pkill -TERM -u $USER -f catia":Do()
50 __"sleep 2":Do()
51 _.killEmAll{'jackdbus', 'a2jmidid'}
52]=]
53 return(0)
54 elseif 'JACK' == args[1] then
55 elseif 'restart' == args[1] then args[1] = 'start'
56 elseif 'force-reload' == args[1] then args[1] = 'start'
57 elseif 'status' == args[1] then
58 return(0)
59 elseif 'help' == args[1] then
60 print(Help)
61 return(0)
62 elseif '--help' == args[1] then
63 print(Help)
64 return(0)
65 else
66 print("Usage: /etc/init.d/aataaj.lua {start|stop|restart|force-reload|status}")
67 return(1)
68 end
69else
70 print("Usage: /etc/init.d/aataaj.lua {help|start|stop|restart|force-reload|status|JACK}")
71 return(1)
72end
73
74
75
76
77-- CHANGE these to suit.
78local asoundrcPath = '/var/lib/aataaj'
79local asoundrc = 'asoundrc'
80local GUI = 'qjackctl'
81if _.exists'catia' then GUI = 'catia' end
82local alias = {
83 {name='Screen', dev='HDMI9'},
84 }
85
86local speaker = 'espeak'
87if _.exists'espeak-ng' then speaker = 'espeak-ng' end
88
89
90for i,l in ipairs(__'df -h':log():Do().lines) do
91 print(l)
92end
93print('')
94
95__'df -h':log():also'free -h':show():Do()
96print('')
97
98for i,l in ipairs(__'df -h\nfree -h':log():Do().lines) do
99 print(l)
100end
101print('')
102
103__[[
104 df -h
105 free -h
106]]:log():show():Do()
107print('')
108
109for i,l in ipairs(__{'df -h', 'free -h'}:log():Do().lines) do
110 print(l)
111end
112print('')
113
114print('' .. GUI)
115print('')
116
117print(__'true':log():show():Do().status)
118print(__'false':log():show():Do().status)
119print(__'exit 42':log():show():Do().status)
120print(__'return 42':log():show():Do().status)
121print(__'command NoSuchCommand':log():show():Do().status)
122