mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 15:11:25 +00:00
* Since atd forks into the background, it wasn't properly monitored by
Upstart. svn path=/nixos/trunk/; revision=16795
This commit is contained in:
parent
44fb2e4ecd
commit
b48a1c394b
@ -8,49 +8,6 @@ let
|
||||
|
||||
inherit (pkgs) at;
|
||||
|
||||
job =
|
||||
''
|
||||
description "at daemon (atd)"
|
||||
|
||||
start on startup
|
||||
stop on shutdown
|
||||
|
||||
start script
|
||||
# Snippets taken and adapted from the original `install' rule of
|
||||
# the makefile.
|
||||
|
||||
# We assume these values are those actually used in Nixpkgs for
|
||||
# `at'.
|
||||
spooldir=/var/spool/atspool
|
||||
jobdir=/var/spool/atjobs
|
||||
etcdir=/etc/at
|
||||
|
||||
for dir in "$spooldir" "$jobdir" "$etcdir"
|
||||
do
|
||||
if [ ! -d "$dir" ]
|
||||
then
|
||||
mkdir -p "$dir" && chown atd:atd "$dir"
|
||||
fi
|
||||
done
|
||||
chmod 1770 "$spooldir" "$jobdir"
|
||||
${if cfg.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""}
|
||||
if [ ! -f "$etcdir"/at.deny ]
|
||||
then
|
||||
touch "$etcdir"/at.deny && \
|
||||
chown root:atd "$etcdir"/at.deny && \
|
||||
chmod 640 "$etcdir"/at.deny
|
||||
fi
|
||||
if [ ! -f "$jobdir"/.SEQ ]
|
||||
then
|
||||
touch "$jobdir"/.SEQ && \
|
||||
chown atd:atd "$jobdir"/.SEQ && \
|
||||
chmod 600 "$jobdir"/.SEQ
|
||||
fi
|
||||
end script
|
||||
|
||||
respawn ${at}/sbin/atd
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@ -106,9 +63,52 @@ in
|
||||
gid = config.ids.gids.atd;
|
||||
};
|
||||
|
||||
services.extraJobs = singleton # !!! convert to job
|
||||
jobs = singleton
|
||||
{ name = "atd";
|
||||
inherit job;
|
||||
|
||||
description = "at daemon (atd)";
|
||||
|
||||
startOn = "startup";
|
||||
stopOn = "shutdown";
|
||||
|
||||
preStart =
|
||||
''
|
||||
# Snippets taken and adapted from the original `install' rule of
|
||||
# the makefile.
|
||||
|
||||
# We assume these values are those actually used in Nixpkgs for
|
||||
# `at'.
|
||||
spooldir=/var/spool/atspool
|
||||
jobdir=/var/spool/atjobs
|
||||
etcdir=/etc/at
|
||||
|
||||
for dir in "$spooldir" "$jobdir" "$etcdir"; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
mkdir -p "$dir" && chown atd:atd "$dir"
|
||||
fi
|
||||
done
|
||||
chmod 1770 "$spooldir" "$jobdir"
|
||||
${if cfg.allowEveryone then ''chmod a+rwxt "$spooldir" "$jobdir" '' else ""}
|
||||
if [ ! -f "$etcdir"/at.deny ]; then
|
||||
touch "$etcdir"/at.deny && \
|
||||
chown root:atd "$etcdir"/at.deny && \
|
||||
chmod 640 "$etcdir"/at.deny
|
||||
fi
|
||||
if [ ! -f "$jobdir"/.SEQ ]; then
|
||||
touch "$jobdir"/.SEQ && \
|
||||
chown atd:atd "$jobdir"/.SEQ && \
|
||||
chmod 600 "$jobdir"/.SEQ
|
||||
fi
|
||||
|
||||
# `atd' doesn't have a no-fork flag, so start it here. !!!
|
||||
# Fix this once we have Upstart 0.6.
|
||||
${at}/sbin/atd
|
||||
'';
|
||||
|
||||
postStop =
|
||||
''
|
||||
test -e /var/run/atd.pid && kill $(cat /var/run/atd.pid)
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user