X-Git-Url: http://git.annexia.org/?p=whenjobs.git;a=blobdiff_plain;f=daemon%2Fdaemon.ml;h=6ccfcce983606075b6457c7c433763fdf4ab8da6;hp=1155f500d2b2bfd270109d2de92cb3eaccb568a9;hb=0bfe72d06b55b0db076c900c6c2173b59c8b75f3;hpb=2701d3a832514ee94d110dfbd4f46f2ab6d9637e diff --git a/daemon/daemon.ml b/daemon/daemon.ml index 1155f50..6ccfcce 100644 --- a/daemon/daemon.ml +++ b/daemon/daemon.ml @@ -353,12 +353,15 @@ and run_job job = (* Create a temporary file containing the shell script fragment. *) let script = dir // "script" in let chan = open_out script in + fprintf chan "set -e\n"; (* So that jobs exit on error. *) output_string chan job.job_script.sh_script; close_out chan; chmod script 0o700; + let shell = try getenv "SHELL" with Not_found -> "/bin/sh" in + (* Execute the shell script. *) - (try execvp "bash" [| "bash"; "-c"; script |]; + (try execvp shell [| shell; "-c"; script |]; with Unix_error (err, fn, _) -> Syslog.error "%s failed: %s: %s" fn script (error_message err) );