Ajout : vm_hosted : rule_nginx_configure .
[lhc/ateliers.git] / etc / init.d / tmpfs
diff --git a/etc/init.d/tmpfs b/etc/init.d/tmpfs
new file mode 100755 (executable)
index 0000000..adf6c72
--- /dev/null
@@ -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