X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=etc%2Finit.d%2Ftmpfs;fp=etc%2Finit.d%2Ftmpfs;h=adf6c72522de002903f4e39090ab49d8ca37482e;hb=ac6452c7821434c9750210bf75a95e51d876dc3d;hp=0000000000000000000000000000000000000000;hpb=deeba8cf50893362d5af7bed3e94119e430af487;p=lhc%2Fateliers.git diff --git a/etc/init.d/tmpfs b/etc/init.d/tmpfs new file mode 100755 index 0000000..adf6c72 --- /dev/null +++ b/etc/init.d/tmpfs @@ -0,0 +1,56 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: tmpfs +# Required-Start: $local_fs +# Required-Stop: $local_fs +# X-Start-Before: nginx +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Initialise tmpfs file systems +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +. /lib/init/vars.sh +. /lib/lsb/init-functions + +do_start() { + if [ -x /etc/rc.local ] + then + [ "$VERBOSE" != no ] && log_begin_msg "Initialising tmpfs file systems" + + ! mountpoint -q /run || + sudo install -d -m 770 -o www-data -g www-data \ + /run/nginx \ + /run/nginx/fastcgi + + ! mountpoint -q /run/shm || + ! test -f /run/shm/.tmpfs || + sudo install -d -m 1777 -o root -g root \ + /run/shm/cache && + sudo install -d -m 660 -o www-data -g www-data \ + /run/shm/cache/nginx \ + /run/shm/cache/nginx/fastcgi \ + /run/shm/cache/nginx/client_body + + ES=$? + [ "$VERBOSE" != no ] && log_end_msg $ES + return $ES + fi + } + +case "$1" in + (start|restart) + do_start + ;; + (reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + (stop) + ;; + (*) + echo "Usage: $0 start|restart|stop" >&2 + exit 3 + ;; + esac