Commit graph

66 commits

Author SHA1 Message Date
Eelco Dolstra a44e575196 switch-to-configuration: Respect the ‘restartIfChanged’ attribute 2012-08-17 13:14:42 -04:00
Eelco Dolstra 981347429a Add support for PartOf dependencies 2012-08-15 15:36:54 -04:00
Eelco Dolstra a44a7271a8 Warn about Upstart modules with an unknown startOn condition 2012-08-14 17:30:11 -04:00
Eelco Dolstra b11c5d5991 nscd: Ensure that invalidate-nscd starts after nscd 2012-08-06 12:26:52 -04:00
Eelco Dolstra 9f9ae7c7e9 Share option definitions between the systemd and Upstart compatibility modules 2012-08-06 11:45:59 -04:00
Eelco Dolstra fd2cef50cd Don't pull in Upstart 2012-07-20 18:25:23 -04:00
Eelco Dolstra 02e37ba6b0 Shorten filenames of start scripts to make log messages more readable 2012-07-19 17:41:42 -04:00
Eelco Dolstra 4c21857ee1 Upstart ‘boot.systemd.services’ for the Upstart compatibility layer 2012-06-18 17:42:26 -04:00
Eelco Dolstra 673bf12b1d Improve the dependencies of units generated by the Upstart emulation 2012-06-18 00:22:18 -04:00
Eelco Dolstra 42ee3b4209 Add a ‘wantedBy’ attribute to unit definitions
This attribute allows a unit to make itself a dependency of another unit.

Also, add an option to set the default target unit.
2012-06-17 23:31:21 -04:00
Eelco Dolstra 4a95f8996b To ease migration to systemd, generate units from the ‘jobs’ option
Also get rid of the ‘buildHook’ job option because it wasn't very useful.
2012-06-16 00:19:43 -04:00
Eelco Dolstra a46894b960 Get lots more systemd stuff working
Enabled a bunch of units that ship with systemd.  Also added an option
‘boot.systemd.units’ that can be used to define additional units
(e.g. ‘sshd.service’).
2012-06-14 18:44:56 -04:00
Eelco Dolstra 03f2847054 * Set preferLocalBuild on a few trivial top-level derivations. These
tend to cause a lot of unnecessary I/O to the build machines.

svn path=/nixos/trunk/; revision=33936
2012-04-26 15:19:23 +00:00
Eelco Dolstra d9e28560d1 * Emit "expect daemon" for the mountall task. Otherwise it may get a
USR1 signal before it has forked into the background (because it
  will be in the start/running state immediately).

svn path=/nixos/trunk/; revision=33288
2012-03-20 10:17:08 +00:00
Eelco Dolstra f546837cdf * Don't use replaceChars. It's slow.
svn path=/nixos/trunk/; revision=33270
2012-03-19 18:07:28 +00:00
Eelco Dolstra fcc2e985a2 * Handle jobs that fail while a post-start script is waiting for them.
svn path=/nixos/trunk/; revision=33269
2012-03-19 18:07:05 +00:00
Eelco Dolstra 8ca2aff772 * Get rid of some grep hackery on the Upstart jobs.
svn path=/nixos/trunk/; revision=33240
2012-03-18 18:53:50 +00:00
Eelco Dolstra 362d1389d3 * mountall: make the "console output" Upstart stanza do its work. We
were redirecting output to /var/log/upstart/<job>, so it didn't work
  properly.
* mountall-ip-up: send the USR1 signal to the mountall process by
  looking up its PID, rather than doing "pkill -USR1 mountall".  This
  prevents a very subtle race condition where USR1 is delivered to a
  child process of mountall (such as fsck), if pkill sees the child
  just before its execve().  There is actually still a race condition
  because mountall installs its USR1 handler *after* daemonising, so
  mountall-ip-up could accidentally kill mountall.  Should report this
  to upstream.

svn path=/nixos/trunk/; revision=33236
2012-03-18 17:48:19 +00:00
Eelco Dolstra 86d8d62d16 * Allow Upstart jobs to declare that they shouldn't be restarted by
switch-to-configuration.  E.g. the X server shouldn't be restarted
  because that kills all the X clients.

svn path=/nixos/trunk/; revision=33223
2012-03-18 02:10:39 +00:00
Eelco Dolstra 3495a773f9 * Improved Upstart job handling in switch-to-configuration. It no
longer compares the current configuration to the previous
  configuration, but instead compares the current Upstart state to the
  intended state.  Thus, if the switch script is interrupted, running
  nixos-rebuild again will resume starting/stopping Upstart jobs where
  the previous run left off.

  We determine if an Upstart job has changed by having the pre-start
  script of each Upstart job put a symlink to its .conf file in
  /var/run/upstart-jobs.  So if this symlink differs from the target
  of /etc/init/<job>.conf, then the job has changed.  This also
  prevents multiple restarts of dependent jobs.  E.g., if job B has
  "start on started A" and "stop on stopping A", then restarting A
  will cause B to be restarted, so B shouldn't B restarted a second
  time.

  We only start jobs that are not running if 1) they're tasks that
  have been previously run (like mountall); or 2) they're jobs that
  have a "start on" condition.  This seems a reasonable heuristic.

svn path=/nixos/trunk/; revision=33222
2012-03-18 01:53:35 +00:00
Eelco Dolstra ee6c9bb998 * Provide two utility functions in Upstart jobs: "ensure JOBNAME"
starts the given job and waits until it's running; "stop_check"
  checks that the current job hasn't been asked to stop.

svn path=/nixos/trunk/; revision=33214
2012-03-17 19:12:33 +00:00
Eelco Dolstra 8935db253c * Upstart jobs: don't emit a description if there is none.
svn path=/nixos/trunk/; revision=32775
2012-03-04 16:17:56 +00:00
Mathijs Kwik dc8ca0ea4a upstart: options for setuid and setgid
as jobs running as different users cannot create their logfile, I moved that to an activationScript

svn path=/nixos/trunk/; revision=32762
2012-03-04 12:58:06 +00:00
Eelco Dolstra 84bff53ca7 * Set the default value for the ‘path’ job attribute using the NixOS
module system so that it can be overriden.  Also use an ‘apply’ to
  compute the actual $PATH.

svn path=/nixos/trunk/; revision=32440
2012-02-20 19:23:15 +00:00
Peter Simons eb6e1310b8 strip trailing whitespace; no functional change
svn path=/nixos/trunk/; revision=29285
2011-09-14 18:20:50 +00:00
Nicolas Pierron ef63ea98f4 Experiment with dual option types (list & attribute sets).
svn path=/nixos/trunk/; revision=27978
2011-07-27 20:55:35 +00:00
Eelco Dolstra c2f7256101 * Added an option `system.upstartEnvironment' to add a variable to all
Upstart jobs.

svn path=/nixos/trunk/; revision=25478
2011-01-09 22:00:41 +00:00
Eelco Dolstra 8a6fad83f4 * Add a job attribute (path) to allow adding packages to the job's
$PATH environment variable.

svn path=/nixos/trunk/; revision=23780
2010-09-14 11:22:17 +00:00
Lluís Batlle i Rossell b25771532a Fixing the postfix start/stop (through an upstart job script code that will
monitor the life of postfix)

Adding an assert to upstart jobs, so those with preStop will always need an exec or
script, otherwise the preStop will not be run.


svn path=/nixos/trunk/; revision=22225
2010-06-11 21:44:06 +00:00
Eelco Dolstra ad93acc295 * Make all Upstart jobs shut down on the `starting shutdown' event.
This ensures that they're gone by the time the shutdown job runs, so
  it doesn't have to stop them itself.
* Don't respawn tasks, as it doesn't seem useful (if they fail they're
  likely to fail again if they're restarted).

svn path=/nixos/trunk/; revision=22099
2010-06-02 16:04:08 +00:00
Eelco Dolstra 94b2268192 * Start "exec" jobs using the "script" stanza to allow redirects in
the job's "exec" to work properly.

svn path=/nixos/trunk/; revision=22094
2010-06-01 20:41:59 +00:00
Eelco Dolstra 95a9c5dd77 * Log the standard output/error of Upstart jobs to
/var/log/upstart/<jobname> rather than spamming the console with it.

svn path=/nixos/trunk/; revision=22093
2010-06-01 19:44:23 +00:00
Eelco Dolstra 5b5aefa030 * Remove some obsolete stuff.
svn path=/nixos/trunk/; revision=20631
2010-03-15 13:41:21 +00:00
Eelco Dolstra 4253490fd4 svn path=/nixos/trunk/; revision=20016 2010-02-15 15:55:54 +00:00
Marc Weber aad3d21ceb upstart: quote environment vars. John Altobelli hit the case TZ=New York
svn path=/nixos/trunk/; revision=19633
2010-01-23 22:38:30 +00:00
Eelco Dolstra d7342c78d4 * Support pre-stop scripts. These are needed to cleanly shutdown
daemons such as Apache or PostgreSQL.

svn path=/nixos/branches/upstart-0.6/; revision=18234
2009-11-06 22:45:19 +00:00
Eelco Dolstra b9bfe7ed43 * Connect Upstart to the system bus.
svn path=/nixos/branches/upstart-0.6/; revision=18213
2009-11-06 15:59:23 +00:00
Eelco Dolstra 9fa2f12cc2 * Do some more jobs.
svn path=/nixos/branches/upstart-0.6/; revision=18212
2009-11-06 15:46:56 +00:00
Eelco Dolstra 903e92bde6 * Use Upstart's "export fork" feature to properly detect when a daemon
is "ready".  This prevents ugly race conditions, e.g. HAL failing to
  start because dbus hasn't finished starting yet.
* Support post-start scripts.  These are executed after the job's main
  process has started but before the job's "started" event is
  emitted.  For instance, the udev job uses this to perform "udevadm
  trigger / settle" to create all devices.  Previously this had to be
  done in the pre-start script, so the daemon had to started in the
  pre-start script as well.

svn path=/nixos/branches/upstart-0.6/; revision=18211
2009-11-06 15:23:16 +00:00
Eelco Dolstra 7011a9315f * Use Upstart 0.6. Jobs are now in /etc/init instead of /etc/event.d.
svn path=/nixos/branches/upstart-0.6/; revision=18192
2009-11-06 10:43:38 +00:00
Eelco Dolstra b581a56d79 * Define the Upstart package to use in one place.
svn path=/nixos/branches/upstart-0.6/; revision=18187
2009-11-06 09:36:35 +00:00
Eelco Dolstra 5fc4590ce5 * Fix indentation.
svn path=/nixos/branches/upstart-0.6/; revision=18186
2009-11-06 09:26:36 +00:00
Eelco Dolstra eba8f94069 * jobAttrs -> jobs.
svn path=/nixos/trunk/; revision=17769
2009-10-12 18:09:34 +00:00
Eelco Dolstra 40c9057a49 * Remove the obsolete "jobs" option.
svn path=/nixos/trunk/; revision=17765
2009-10-12 17:32:30 +00:00
Eelco Dolstra d982f23f20 * Convert the remaining jobs to jobAttrs style.
svn path=/nixos/trunk/; revision=17764
2009-10-12 17:27:57 +00:00
Eelco Dolstra 9943e0762e * Update some more modules.
svn path=/nixos/trunk/; revision=17763
2009-10-12 17:09:38 +00:00
Eelco Dolstra e91d882a94 * Converted modules that were still using the old (concrete syntax)
style of declaring Upstart jobs.  While at it, converted them to the
  current NixOS module style and improved some option descriptions.
  Hopefully I didn't break too much :-)

svn path=/nixos/trunk/; revision=17761
2009-10-12 16:36:19 +00:00
Nicolas Pierron 2969f36b15 Add the computation of upstart-packages inside the job sub-module by adding
the option named "upstartPkg".

Move the obsolete option "services.extraJobs" to the rename module.

svn path=/nixos/trunk/; revision=17672
2009-10-06 09:30:13 +00:00
Marc Weber d0c68bc9ab adding jobAttrs which is filled from jobs contents
Purpose: Allow overwriding of properties such as:
           config.jobAttrs.sshd.startOn = "never";

thanks to Nicolas Pierron for reviewing and
extending nixpkgs to make this possible

I'll convert most of the jobs ASAP so please don't care
about the depreceateion much right now

svn path=/nixos/trunk/; revision=17650
2009-10-05 18:31:27 +00:00
Eelco Dolstra 17d287afa5 * Bump the number of maximum open files for Nix builders.
Our VM builds were causing Samba to go over this limit.

svn path=/nixos/trunk/; revision=16960
2009-09-04 15:27:52 +00:00