|
@@ -5,6 +5,29 @@ stop on runlevel [!2345]
|
|
|
|
|
|
respawn
|
|
respawn
|
|
|
|
|
|
|
|
+pre-start script
|
|
|
|
+ # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
|
|
|
|
+ if grep -v '^#' /etc/fstab | grep -q cgroup \
|
|
|
|
+ || [ ! -e /proc/cgroups ] \
|
|
|
|
+ || [ ! -d /sys/fs/cgroup ]; then
|
|
|
|
+ exit 0
|
|
|
|
+ fi
|
|
|
|
+ if ! mountpoint -q /sys/fs/cgroup; then
|
|
|
|
+ mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
|
|
|
+ fi
|
|
|
|
+ (
|
|
|
|
+ cd /sys/fs/cgroup
|
|
|
|
+ for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
|
|
|
|
+ mkdir -p $sys
|
|
|
|
+ if ! mountpoint -q $sys; then
|
|
|
|
+ if ! mount -n -t cgroup -o $sys cgroup $sys; then
|
|
|
|
+ rmdir $sys || true
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+ )
|
|
|
|
+end script
|
|
|
|
+
|
|
script
|
|
script
|
|
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
|
|
# modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
|
|
DOCKER=/usr/bin/$UPSTART_JOB
|
|
DOCKER=/usr/bin/$UPSTART_JOB
|
|
@@ -12,15 +35,5 @@ script
|
|
if [ -f /etc/default/$UPSTART_JOB ]; then
|
|
if [ -f /etc/default/$UPSTART_JOB ]; then
|
|
. /etc/default/$UPSTART_JOB
|
|
. /etc/default/$UPSTART_JOB
|
|
fi
|
|
fi
|
|
- if ! grep -q cgroup /proc/mounts; then
|
|
|
|
- # rough approximation of cgroupfs-mount
|
|
|
|
- mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
|
|
|
- for sys in $(cut -d' ' -f1 /proc/cgroups); do
|
|
|
|
- mkdir -p /sys/fs/cgroup/$sys
|
|
|
|
- if ! mount -n -t cgroup -o $sys cgroup /sys/fs/cgroup/$sys 2>/dev/null; then
|
|
|
|
- rmdir /sys/fs/cgroup/$sys 2>/dev/null || true
|
|
|
|
- fi
|
|
|
|
- done
|
|
|
|
- fi
|
|
|
|
"$DOCKER" -d $DOCKER_OPTS
|
|
"$DOCKER" -d $DOCKER_OPTS
|
|
end script
|
|
end script
|