3
0
Fork 0
forked from mirrors/nixpkgs

* Slight speedup. It's amazing how quickly shell scripts become

slow: calling basename in a loop somewhere has a noticable impact on
  performance.  We really shouldn't use bash scripts.

svn path=/nixos/trunk/; revision=33242
This commit is contained in:
Eelco Dolstra 2012-03-18 19:05:44 +00:00
parent 53580d514a
commit b1fd71038e
2 changed files with 4 additions and 4 deletions

View file

@ -106,8 +106,7 @@ declare -A noRestartIfChanged=(@noRestartIfChanged@)
# all jobs that don't have a "stop" goal.) We use the symlinks in
# /var/run/upstart-jobs (created by each job's pre-start script) to
# determine if a job has changed.
for job in $(cd $jobsDir && ls *.conf); do
job=$(basename $job .conf)
for job in @jobs@; do
status=$(status "$job")
if ! [[ "$status" =~ start/ ]]; then continue; fi
if [ "$(readlink -f "$jobsDir/$job.conf")" = "$(readlink -f "/var/run/upstart-jobs/$job")" ]; then continue; fi
@ -128,8 +127,7 @@ done
# differs from the previous instance of the same task; if it wasn't
# previously run, don't run it. If it's a service, only start it if
# it has a "start on" condition.
for job in $(cd $jobsDir && ls *.conf); do
job=$(basename $job .conf)
for job in @jobs@; do
status=$(status "$job")
if ! [[ "$status" =~ stop/ ]]; then continue; fi

View file

@ -154,6 +154,8 @@ let
initScriptBuilder = config.system.build.initScriptBuilder;
activationScript = config.system.activationScripts.script;
jobs = map (j: j.name) (attrValues config.jobs);
# Pass the names of all Upstart tasks to the activation script.
tasks = attrValues (mapAttrs (n: v: if v.task then ["[${v.name}]=1"] else []) config.jobs);