mirror of https://github.com/einverne/dotfiles.git
Ein Verne
4 years ago
6 changed files with 12 additions and 25 deletions
@ -1,27 +1,15 @@
|
||||
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) |
||||
function taskCallback(exitCode, stdOut, stdErr) |
||||
log.i("task call back ", exitCode, stdOut, stdErr) |
||||
end |
||||
|
||||
function runAutoScripts() |
||||
for key, cmd in ipairs(cmdArr) do |
||||
log.i("execute" .. key .. " " .. cmd) |
||||
shell(cmd) |
||||
args = {"-c", "/Users/einverne/Sync/wiki/auto-push.sh"} |
||||
autoCommitTask = hs.task.new("/bin/bash", taskCallback, args) |
||||
autoCommitTask:setWorkingDirectory("/Users/einverne/Sync/wiki/") |
||||
autoCommitTask:start() |
||||
end |
||||
end |
||||
|
||||
|
||||
myTimer = hs.timer.doEvery(7200, runAutoScripts) |
||||
myTimer:start() |
||||
|
Loading…
Reference in new issue