(* 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)
);