summaryrefslogtreecommitdiff
path: root/desktop-cronish
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-cronish')
-rwxr-xr-xdesktop-cronish9
1 files changed, 8 insertions, 1 deletions
diff --git a/desktop-cronish b/desktop-cronish
index f69d16e..738d29c 100755
--- a/desktop-cronish
+++ b/desktop-cronish
@@ -17,6 +17,7 @@
import cliapp
import time
+import sys
import yaml
@@ -68,9 +69,15 @@ class DesktopCronish(cliapp.Application):
def execute_job(self, job_name):
job = self.jobs[job_name]
- exit, out, err = cliapp.runcmd_unchecked(['sh', '-c', job['command']])
+ argv = ['sh', '-c', job['command']]
+ if 'timeout' in job:
+ argv = ['timeout', str(job['timeout'])] + argv
+ exit, out, err = cliapp.runcmd_unchecked(argv)
self.output.write(out)
if exit != 0:
+ sys.stderr.write(
+ 'ERROR: Job %s: Command failed: %s\n' %
+ (job_name, ' '.join(argv)))
sys.stderr.write(err)
self.previously[job_name] = self.now()