aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x.aataaj_JACK.lua7
-rwxr-xr-x_.lua77
-rwxr-xr-xaataaj.lua7
-rwxr-xr-xtest_.lua15
4 files changed, 40 insertions, 66 deletions
diff --git a/.aataaj_JACK.lua b/.aataaj_JACK.lua
index 91888d2..d659d50 100755
--- a/.aataaj_JACK.lua
+++ b/.aataaj_JACK.lua
@@ -3,12 +3,5 @@
3-- An example users .aataaj_JACK.lua script that just starts qsynth. 3-- An example users .aataaj_JACK.lua script that just starts qsynth.
4 4
5local _ = require '_' 5local _ = require '_'
6local D = _.D
7local I = _.I
8local T = _.T
9local W = _.W
10local E = _.E
11local C = _.C
12local __ = _._
13 6
14if _.runnable'qsynth' then __'qsynth':forkOnce() end 7if _.runnable'qsynth' then __'qsynth':forkOnce() end
diff --git a/_.lua b/_.lua
index 42c3b4a..19b73b4 100755
--- a/_.lua
+++ b/_.lua
@@ -3,21 +3,41 @@
3 3
4-- Most of this _ stuff was copied from apt-panopticon. 4-- Most of this _ stuff was copied from apt-panopticon.
5local _ = {} 5local _ = {}
6
7_.version = '0.0 crap' 6_.version = '0.0 crap'
8 7
9_.D = function(s) print('DEBUG ' .. s) end 8
10_.I = function(s) print('INFO ' .. s) end 9D = function(s) print('DEBUG ' .. s) end
11_.T = function(s) print('TIMEOUT ' .. s) end 10I = function(s) print('INFO ' .. s) end
12_.W = function(s) print('WARNING ' .. s) end 11T = function(s) print('TIMEOUT ' .. s) end
13_.E = function(s) print('ERROR ' .. s) end 12W = function(s) print('WARNING ' .. s) end
14_.C = function(s) print('CRITICAL ' .. s) end 13E = function(s) print('ERROR ' .. s) end
15local D = _.D 14C = function(s) print('CRITICAL ' .. s) end
16local I = _.I 15
17local T = _.T 16
18local W = _.W 17_.runnable = function(c)
19local E = _.E 18 return ( 0 == __('which ' .. c):Do().status )
20local C = _.C 19end
20
21_.running = function(c)
22 return ( 1 ~= tonumber(__("pgrep -u $USER -cf " .. c):Do().lines[1]) )
23end
24
25_.exists = function(f)
26 local h, e = io.open(f, "r")
27 if nil == h then return false else h:close(); return true end
28end
29
30_.killEmAll = function(all)
31 for i,l in ipairs(all) do
32 local c = 0
33 while 0 ~= tonumber(__("pgrep -u $USER -xc " .. l):Do().lines[1]) do
34 local s = 'TERM'
35 if c > 1 then s = 'KILL'; __("sleep " .. c):Do() end
36 __("pkill -" .. s .. " -u $USER -x " .. l):log():Do()
37 c = c + 1
38 end
39 end
40end
21 41
22 42
23_.readCmd = function(cmd) 43_.readCmd = function(cmd)
@@ -33,8 +53,7 @@ _.readCmd = function(cmd)
33 return result 53 return result
34end 54end
35 55
36 56__ = function(c)
37_._ = function(c)
38 local exe = {status = 0, lines = {}, logging = false, showing = false, cmd = '', command = c} 57 local exe = {status = 0, lines = {}, logging = false, showing = false, cmd = '', command = c}
39 local n = 0 58 local n = 0
40 59
@@ -165,33 +184,5 @@ _._ = function(c)
165 return exe 184 return exe
166end 185end
167 186
168local __ = _._
169
170_.runnable = function(c)
171 return ( 0 == __('which ' .. c):Do().status )
172end
173
174_.running = function(c)
175 return ( 1 ~= tonumber(__("pgrep -u $USER -cf " .. c):Do().lines[1]) )
176end
177
178_.exists = function(f)
179 local h, e = io.open(f, "r")
180 if nil == h then return false else h:close(); return true end
181end
182
183_.killEmAll = function(all)
184 for i,l in ipairs(all) do
185 local c = 0
186 while 0 ~= tonumber(__("pgrep -u $USER -xc " .. l):Do().lines[1]) do
187 local s = 'TERM'
188 if c > 1 then s = 'KILL'; __("sleep " .. c):Do() end
189 __("pkill -" .. s .. " -u $USER -x " .. l):log():Do()
190 c = c + 1
191 end
192 end
193end
194
195
196 187
197return _ 188return _
diff --git a/aataaj.lua b/aataaj.lua
index 83dd827..655c7ef 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -15,13 +15,6 @@
15]] 15]]
16 16
17local _ = require '_' 17local _ = require '_'
18local D = _.D
19local I = _.I
20local T = _.T
21local W = _.W
22local E = _.E
23local C = _.C
24local __ = _._
25 18
26 19
27 20
diff --git a/test_.lua b/test_.lua
index 629c151..c9884ea 100755
--- a/test_.lua
+++ b/test_.lua
@@ -2,13 +2,6 @@
2 2
3 3
4local _ = require '_' 4local _ = require '_'
5local D = _.D
6local I = _.I
7local T = _.T
8local W = _.W
9local E = _.E
10local C = _.C
11local __ = _._
12 5
13 6
14D('Starting from the top.') 7D('Starting from the top.')
@@ -114,5 +107,9 @@ print(__'exit 42':log():show():Do().status)
114print(__'return 42':log():show():Do().status) 107print(__'return 42':log():show():Do().status)
115print(__'command NoSuchCommand':log():show():Do().status) 108print(__'command NoSuchCommand':log():show():Do().status)
116 109
117__'qpdfview':forkOnce() 110--__'qpdfview':forkOnce()
118__'qpdfview':forkOnce() 111--__'qpdfview':forkOnce()
112
113
114D('debug?')
115I('info?') \ No newline at end of file