Ajout : vm_hosted : rule_tmpfs_configure .
[lhc/ateliers.git] / etc / init.d / tmpfs
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: tmpfs
4 # Required-Start: $local_fs
5 # Required-Stop: $local_fs
6 # X-Start-Before: nginx
7 # Default-Start: 2 3 4 5
8 # Default-Stop: 0 1 6
9 # Short-Description: Initialise tmpfs file systems
10 ### END INIT INFO
11
12 PATH=/sbin:/usr/sbin:/bin:/usr/bin
13
14 . /lib/init/vars.sh
15 . /lib/lsb/init-functions
16
17 do_start() {
18 if [ -x /etc/rc.local ]
19 then
20 [ "$VERBOSE" != no ] && log_begin_msg "Initialising tmpfs file systems"
21
22 ! mountpoint -q /run ||
23 sudo install -d -m 770 -o www-data -g www-data \
24 /run/nginx \
25 /run/nginx/fastcgi
26
27 if mountpoint -q /run/shm &&
28 test -f /run/shm/.tmpfs
29 then
30 sudo install -d -m 1777 -o root -g root \
31 /run/shm/cache
32
33 ! getent passwd www-data ||
34 sudo install -d -m 660 -o www-data -g www-data \
35 /run/shm/cache/nginx \
36 /run/shm/cache/nginx/fastcgi \
37 /run/shm/cache/nginx/client_body
38
39 ! getent passwd php5 ||
40 sudo install -d -m 1667 -o php5 -g php5 \
41 /run/shm/cache/php5 \
42 /run/shm/cache/php5/fpm
43 fi
44
45 ES=$?
46 [ "$VERBOSE" != no ] && log_end_msg $ES
47 return $ES
48 fi
49 }
50
51 case "$1" in
52 (start|restart)
53 do_start
54 ;;
55 (reload|force-reload)
56 echo "Error: argument '$1' not supported" >&2
57 exit 3
58 ;;
59 (stop)
60 ;;
61 (*)
62 echo "Usage: $0 start|restart|stop" >&2
63 exit 3
64 ;;
65 esac