#!/bin/bash
user=`apachectl -S | grep User | perl -ne '/\"([\w\-]+)\"/; print $1'`

if [[ `ps -efl | grep celltest-passwd | grep ABF` ]]
    then 
    echo "Password server runing, nothig to do"
else 
    if [[ `grep RFCcontrol-ssl /usr/local/bin/celltest/start_servers` ]]
	then
	echo "Automatic start of RFCcontrol-ssl-server already implemented."
    else
	echo "/bin/su - $user -s /bin/sh -c '/usr/local/bin/celltest/RFCcontrol-ssl-server > /dev/null &'" >> /usr/local/bin/celltest/start_servers 
	/bin/su - $user -s /bin/sh -c '/usr/local/bin/celltest/RFCcontrol-ssl-server > /dev/null &'
    fi
fi
