Modification : vm_hosted : insserv -> runit .
[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 set -x
31 sudo install -d -m 1777 -o root -g root \
32 /run/shm/cache \
33 /run/shm/tmp
34
35 ! getent passwd www-data >/dev/null ||
36 sudo install -d -m 770 -o www-data -g www-data \
37 /run/shm/cache/nginx \
38 /run/shm/cache/nginx/fastcgi \
39 /run/shm/cache/nginx/client_body
40
41 ! getent passwd php5 >/dev/null ||
42 sudo install -d -m 1771 -o php5 -g php5 \
43 /run/php5 \
44 /run/php5/fpm \
45 /run/shm/cache/php5 \
46 /run/shm/cache/php5/fpm \
47 /run/shm/tmp/php5
48
49 ! getent passwd fcgi-gitweb >/dev/null ||
50 sudo install -d -m 1771 -o fcgi-gitweb -g fcgi-gitweb \
51 /run/shm/tmp/gitweb
52
53 ! getent passwd mysql >/dev/null ||
54 sudo install -d -m 1771 -o mysql -g mysql \
55 /run/mysqld \
56 /run/mysqld/sock
57
58 ! getent passwd postgres >/dev/null ||
59 sudo install -d -m 710 -o postgres -g postgres-data \
60 /run/postgresql
61
62 ! getent passwd postgrey >/dev/null ||
63 sudo install -d -m 2710 -o postgrey -g postfix \
64 /run/postgrey
65
66 sudo install -d -m 1771 -o root -g root \
67 /run/spawn-fcgi
68 fi
69
70 ES=$?
71 [ "$VERBOSE" != no ] && log_end_msg $ES
72 return $ES
73 fi
74 }
75
76 case "$1" in
77 (start|restart)
78 do_start
79 ;;
80 (reload|force-reload)
81 echo "Error: argument '$1' not supported" >&2
82 exit 3
83 ;;
84 (stop)
85 ;;
86 (*)
87 echo "Usage: $0 start|restart|stop" >&2
88 exit 3
89 ;;
90 esac