my personal dotfiles managed by dotbot, zinit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
log = hs.logger.new('autoscript', 'debug')
|
|
|
|
local cmdArr = {
|
|
|
|
"cd /Users/einverne/Sync/wiki/ && /bin/bash auto-push.sh",
|
|
|
|
"/usr/bin/rsync --remove-source-files -azvh ~/Downloads/*.torrent omv_proxy:/sharedfolders/pt/watch/ >> /tmp/rsync-bittorrent.log",
|
|
|
|
}
|
|
|
|
|
|
|
|
function shell(cmd)
|
|
|
|
hs.alert.show("execute")
|
|
|
|
log.i('execute')
|
|
|
|
output, status, t, rc = hs.execute(string.format("%s", cmd), true)
|
|
|
|
-- result, output, err = hs.osascript.applescript(string.format('do shell script "%s"', cmd))
|
|
|
|
log.i(output)
|
|
|
|
log.i(status)
|
|
|
|
log.i(t)
|
|
|
|
log.i(rc)
|
|
|
|
end
|
|
|
|
|
|
|
|
function runAutoScripts()
|
|
|
|
for key, cmd in ipairs(cmdArr) do
|
|
|
|
log.i("execute" .. key .. " " .. cmd)
|
|
|
|
shell(cmd)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
myTimer = hs.timer.doEvery(7200, runAutoScripts)
|
|
|
|
myTimer:start()
|