updated on Thu Jan 19 12:17:07 UTC 2012
[aur-mirror.git] / ravencore / ravencore.init
blob3e3de03e56cc731034e353249ce2710d9580a5a5
1 #!/bin/bash
3 # RavenCore Hosting Control Panel
4 # Copyright (C) 2005 Corey Henderson
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 # ravencore Startup script for the RavenCore Hosting Control Panel
23 # description: A Free Hosting Control Panel
24 # processname: ravencore.httpd
25 # config: /usr/local/ravencore/etc/ravencore.httpd.conf
26 # pidfile: /usr/local/ravencore/var/run/ravencore.httpd.pid
28 # Adapted for ArchLinux - SharkOS.org :: Chris Tusa <linisys@gmail.com>
30 . /etc/rc.conf
31 . /etc/rc.d/functions
32 . /etc/ravencore.conf || exit 1
35 echo -n $"Starting control panel: "
37 $RC_ROOT/sbin/run_cmd rcserver
40 PID=`pidof -o %PPID /usr/local/ravencore/sbin/ravencore.httpd`
41 PID2=`cat $RC_ROOT/var/run/rcserver.pid`
42 case "$1" in
43 start)
44 stat_busy "Starting Ravencore control panel"
45 [ -z "$PID" ] && $RC_ROOT/sbin/run_cmd rcserver
46 if [ $? -gt 0 ]; then
47 stat_fail
48 else
49 add_daemon ravencore
50 if [ ! -f $RC_ROOT/var/run/install_complete ]; then
51 echo
52 echo "----------"
53 echo
54 echo "Thank You for using RavenCore!"
55 echo
56 echo "The install/upgrade process will not be completed until after you login to the control panel web interface as the admin user, and accept the license agreement (GPL)."
57 echo
58 # simple loop to get all IP addresses bound to a machine
59 IP_ADDRESSES=$(for IFACE in `ifconfig | grep -v '^ ' | awk '{print $1}'`; do echo $(for i in `ifconfig | awk "/^\$IFACE/ {print \\$1}"`; do ifconfig $i | grep -o 'addr:[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3$
60 for i in $IP_ADDRESSES; do echo "http://"$i":8000/"; done
61 echo
62 passwd=$(cat $RC_ROOT/.shadow 2> /dev/null)
63 if [ "$passwd" = "ravencore" ]; then
64 echo "NOTE: You have not yet set your admin password!"
65 echo "You can do this by running this as root: "$RC_ROOT"/sbin/run_cmd passwd"
68 stat_done
72 stop)
73 stat_busy "Stopping Ravencore control panel"
74 [ ! -z "$PID" ] && kill $PID &> /dev/null
75 if [ $? -gt 0 ]; then
76 stat_fail
77 else
78 rm_daemon glusterfs
79 stat_done
82 restart)
83 $0 stop
84 sleep 1
85 $0 start
88 echo "usage: $0 {start|stop|restart}"
89 esac
90 exit 0