From 5dc8bc5f2a426ba653eaf14f9d76d4bfe5d0b806 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Sat, 18 Aug 2012 14:25:09 +0200 Subject: [PATCH] Do not assume that /dev/console can always be written. --- modules/system/upstart/upstart.nix | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix index 961b3ad3cba2..c5bdd5c66c4f 100644 --- a/modules/system/upstart/upstart.nix +++ b/modules/system/upstart/upstart.nix @@ -45,9 +45,7 @@ let ${optionalString (job.console != "") "console ${job.console}"} pre-start script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 ln -sfn "$(readlink -f "/etc/init/${job.name}.conf")" /var/run/upstart-jobs/${job.name} ${optionalString (job.preStart != "") '' source ${jobHelpers} @@ -60,9 +58,7 @@ let else if job.script != "" then '' script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.script} end script @@ -83,9 +79,7 @@ let ${optionalString (job.postStart != "") '' post-start script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.postStart} end script @@ -98,9 +92,7 @@ let # (upstart 0.6.5, job.c:562) optionalString (job.preStop != "") (assert hasMain; '' pre-stop script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.preStop} end script @@ -108,9 +100,7 @@ let ${optionalString (job.postStop != "") '' post-stop script - ${optionalString (job.console == "") '' - exec >> ${log} 2>&1 - ''} + ${optionalString (job.console != "") "echo || "} exec >> ${log} 2>&1 source ${jobHelpers} ${job.postStop} end script