packages/prosody: move user/group creation from postinst to initscript
[openwrt/svn-archive/archive.git] / net / prosody / files / prosody.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2010-2011 OpenWrt.org
3
4 START=99
5
6 EXTRA_COMMANDS="status"
7 EXTRA_HELP=" status Print the status of the service"
8
9 BIN=/usr/bin/prosodyctl
10 LOG_D=/var/log/prosody
11 RUN_D=/var/run/prosody
12 PID_F=$RUN_D/prosody.pid
13 RUN_USER=prosody
14 RUN_GROUP=prosody
15
16 start() {
17 user_exists prosody 54 || user_add prosody 54
18 group_exists prosody 54 || group_add prosody 54
19 [ -d /var/run/prosody ] || {
20 mkdir -m 0755 -p /var/run/prosody
21 chown prosody:prosody /var/run/prosody
22 }
23 [ -d /var/log/prosody ] || {
24 mkdir -m 0755 -p /var/log/prosody
25 chown prosody:prosody /var/log/prosody
26 }
27
28 $BIN start
29 }
30
31 stop() {
32 $BIN stop
33 }
34
35 reload() {
36 [ -f $PID_F ] && kill -HUP $(cat $PID_F)
37 }
38
39 status() {
40 $BIN status
41 }