diff options
author | dvs1 | 2024-10-21 18:55:20 +1000 |
---|---|---|
committer | dvs1 | 2024-10-21 18:55:20 +1000 |
commit | 0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05 (patch) | |
tree | 61f4f3b2197a7ae36c2dc064fc9f9c55a292430b /test_.lua | |
parent | Tweak the "didn't die" sleep. (diff) | |
download | JackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.zip JackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.tar.gz JackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.tar.bz2 JackOnAllDevices-0c4e8c635d9a25712d65af9b6dcf6fbad4a72b05.tar.xz |
Restructure the APT.exe stuff.
Diffstat (limited to '')
-rwxr-xr-x | test_.lua | 122 |
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 | |||
4 | local _ = require '_' | ||
5 | local D = _.D | ||
6 | local I = _.I | ||
7 | local T = _.T | ||
8 | local W = _.W | ||
9 | local E = _.E | ||
10 | local C = _.C | ||
11 | local __ = _._ | ||
12 | |||
13 | |||
14 | D('Starting from the top.') | ||
15 | |||
16 | local Help = [[ | ||
17 | This is part of the blah blah blah... | ||
18 | ]] | ||
19 | |||
20 | |||
21 | |||
22 | local args = {...} | ||
23 | if 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 | __[[ | ||
33 | a2j_control --stop | ||
34 | sleep 2 | ||
35 | a2j_control --exit | ||
36 | sleep 2 | ||
37 | ]]:Do() | ||
38 | _.killEmAll{'alsa_in', 'alsa_out', 'zita-a2j', 'zita-j2a', 'aseqjoy', 'jack-plumbing'} | ||
39 | __[[ | ||
40 | sleep 2 | ||
41 | jack_control stop | ||
42 | sleep 2 | ||
43 | jack_control exit | ||
44 | sleep 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 | ||
69 | else | ||
70 | print("Usage: /etc/init.d/aataaj.lua {help|start|stop|restart|force-reload|status|JACK}") | ||
71 | return(1) | ||
72 | end | ||
73 | |||
74 | |||
75 | |||
76 | |||
77 | -- CHANGE these to suit. | ||
78 | local asoundrcPath = '/var/lib/aataaj' | ||
79 | local asoundrc = 'asoundrc' | ||
80 | local GUI = 'qjackctl' | ||
81 | if _.exists'catia' then GUI = 'catia' end | ||
82 | local alias = { | ||
83 | {name='Screen', dev='HDMI9'}, | ||
84 | } | ||
85 | |||
86 | local speaker = 'espeak' | ||
87 | if _.exists'espeak-ng' then speaker = 'espeak-ng' end | ||
88 | |||
89 | |||
90 | for i,l in ipairs(__'df -h':log():Do().lines) do | ||
91 | print(l) | ||
92 | end | ||
93 | print('') | ||
94 | |||
95 | __'df -h':log():also'free -h':show():Do() | ||
96 | print('') | ||
97 | |||
98 | for i,l in ipairs(__'df -h\nfree -h':log():Do().lines) do | ||
99 | print(l) | ||
100 | end | ||
101 | print('') | ||
102 | |||
103 | __[[ | ||
104 | df -h | ||
105 | free -h | ||
106 | ]]:log():show():Do() | ||
107 | print('') | ||
108 | |||
109 | for i,l in ipairs(__{'df -h', 'free -h'}:log():Do().lines) do | ||
110 | print(l) | ||
111 | end | ||
112 | print('') | ||
113 | |||
114 | print('' .. GUI) | ||
115 | print('') | ||
116 | |||
117 | print(__'true':log():show():Do().status) | ||
118 | print(__'false':log():show():Do().status) | ||
119 | print(__'exit 42':log():show():Do().status) | ||
120 | print(__'return 42':log():show():Do().status) | ||
121 | print(__'command NoSuchCommand':log():show():Do().status) | ||
122 | |||