own3mall 9 лет назад
Родитель
Сommit
0042b994cc

+ 0 - 43
OGP/includes/ogp_agent.init

@@ -1,43 +0,0 @@
-#!/bin/bash
-
-# Generic Init script if we can't find what kind of Linux we're on
-
-agent_dir=OGP_AGENT_DIR
-agent_user=OGP_USER
-
-# Start function.
-start() {
-    echo "Starting OGP Agent..."
-    cd $agent_dir
-    su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user &> $agent_dir/ogp_agent.svc &
-    echo
-}
-
-# Stop function.
-stop() {
-    echo "Stopping OGP Agent..."
-    kill `cat $agent_dir/ogp_agent_run.pid`
-}
-
-restart() {
-    stop
-    start
-}
-
-case $1 in
-    start)
-    start
-    ;;
-    stop)
-    stop
-    ;;
-    restart)
-    restart
-    ;;
-    *)
-    echo "Usage: ogp_agent {start|stop|restart}"
-    exit 1
-    ;;
-esac
-
-exit 0;

+ 0 - 139
OGP/includes/ogp_agent.init.dbn

@@ -1,139 +0,0 @@
-#!/bin/bash
-#
-### BEGIN INIT INFO
-# Provides:          ogp_agent
-# Required-Start:    $all
-# Required-Stop:     $all
-# Should-Start:      $all
-# Should-Stop:       $all
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start and stop the OGP Agent
-# Description:       Start and stop the OGP Agent
-### END INIT INFO
-#
-set -e
-set -u
-${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
-
-. /lib/lsb/init-functions
-
-agent_dir=OGP_AGENT_DIR
-agent_user=OGP_USER
-
-#
-# main()
-#
-
-if [ "X`whoami`" != "Xroot" ]
-then
-	log_failure_msg "Permission denied."
-	exit 1
-fi
-
-start() {
-	if [ -e "$agent_dir/ogp_agent_run.pid" ]
-	then
-		if [ "X$(ps -A | grep -o `cat $agent_dir/ogp_agent_run.pid`)" != "X" ]
-		then
-			log_failure_msg "OGP Agent already running."
-			return 1
-		fi
-	fi
-
-	# Lets the agent user to use sudo to enable FTP accounts and use renice and taskset.
-	if [ "$( groups $agent_user | grep "\bsudo\b" )" == "" ]
-	then
-		if [ "$( egrep -i "^sudo" /etc/group )" == "" ]
-		then
-			groupadd sudo >/dev/null 2>&1
-		fi
-		usermod -aG sudo $agent_user >/dev/null 2>&1
-	fi
-
-	chown -Rf `id -u $agent_user`:`id -g $agent_user` $agent_dir >/dev/null 2>&1
-
-	# Lets the agent user to attach screens.
-	if [ "$( groups $agent_user | grep "\btty\b" )" == "" ]
-	then
-		usermod -aG tty $agent_user >/dev/null 2>&1
-	fi
-
-	chmod g+rw /dev/pts/* >/dev/null 2>&1
-	chmod g+rw /dev/tty* >/dev/null 2>&1
-
-	# Check the FTP status
-	if [ -f "/etc/init.d/pure-ftpd" ] && [ -e "/etc/pure-ftpd/conf" ]
-	then
-		echo no > /etc/pure-ftpd/conf/PAMAuthentication
-		echo no > /etc/pure-ftpd/conf/UnixAuthentication
-		echo yes > /etc/pure-ftpd/conf/CreateHomeDir
-
-		if [ ! -f /etc/pure-ftpd/pureftpd.passwd ]
-		then
-			touch /etc/pure-ftpd/pureftpd.passwd
-		fi
-
-		if [ ! -f /etc/pureftpd.passwd ]
-		then
-			ln -s /etc/pure-ftpd/pureftpd.passwd /etc/pureftpd.passwd
-		fi
-
-		if [ ! -f /etc/pure-ftpd/auth/50pure ]
-		then
-			ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure
-		fi
-
-		if [ ! -f /etc/pureftpd.pdb ]
-		then
-			ln -s /etc/pure-ftpd/pureftpd.pdb /etc/pureftpd.pdb
-		fi
-		pure-pw mkdb >/dev/null 2>&1
-		service pure-ftpd force-reload >/dev/null 2>&1 &
-	fi
-
-	cd $agent_dir
-	su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user &> $agent_dir/ogp_agent.svc &
-	log_success_msg "OGP Agent started successfully."
-	echo "Use \"sudo su -c 'screen -S ogp_agent -r' $agent_user\" to attach the agent screen,"
-	echo "and CTRL+A+D to detach it."
-	return 0
-}
-
-stop() {
-	if [ -e "$agent_dir/ogp_agent_run.pid" ]
-	then
-		if [ "X$(ps -A | grep -o `cat $agent_dir/ogp_agent_run.pid`)" == "X" ]
-		then
-			log_failure_msg "OGP Agent not running."
-		else
-			kill `cat $agent_dir/ogp_agent_run.pid` >/dev/null 2>&1
-			log_success_msg "OGP Agent stopped successfully."
-		fi
-	else
-		log_failure_msg "PID file not found ($agent_dir/ogp_agent_run.pid)"
-	fi
-	return 0
-}
-
-case "${1:-''}" in
-	start)
-	start
-	RETVAL=$?
-	;;
-	stop)
-	stop
-	RETVAL=$?
-	;;
-	restart)
-	stop
-	sleep 1
-	start
-	RETVAL=$?
-	;;
- 	*)
-	echo "Usage: service ogp_agent start|stop|restart"
-	RETVAL=1
-	;;
-esac
-exit $RETVAL

+ 0 - 25
OGP/includes/ogp_agent.init.gentoo

@@ -1,25 +0,0 @@
-#!/sbin/runscript
-
-# Distributed under the terms of the GNU General Public License v2
-
-# GF: Config is in $agent_dir/Cfg/Config.pm
-
-agent_dir=OGP_AGENT_DIR
-agent_user=OGP_USER
-
-depend() {
-	need net
-}
-
-start() {
-	ebegin "Starting OGP Agent"
-        start-stop-daemon --verbose --chdir $agent_dir --start --background --user $agent_user -e PWD="$agent_dir" --exec screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid
-        eend $? "Failed to start OGP Agent"
-}
-
-stop() {
-	ebegin "Stopping OGP Agent"
-	start-stop-daemon --stop --quiet --pidfile $agent_dir/ogp_agent_run.pid
-	eend $? "Failed to stop OGP Agent"
-}
-

+ 0 - 156
OGP/includes/ogp_agent.init.rh

@@ -1,156 +0,0 @@
-#!/bin/sh
-
-#
-#   Startup/shutdown script for the OGP Agent.
-#
-#   Linux chkconfig stuff:
-#
-#   chkconfig: 2345 88 10
-#   description: Startup/shutdown script for the OGP Agent
-
-agent_dir=OGP_AGENT_DIR
-agent_user=OGP_USER
-service=ogp_agent
-
-# Source function library.
-if [ -f /etc/rc.d/init.d/functions ] ; then
-	. /etc/rc.d/init.d/functions
-elif [ -f /etc/init.d/functions ] ; then
-	. /etc/init.d/functions
-fi
-
-if [ "$( whoami )" != "root" ]
-then
-	if [ -f "/usr/bin/sudo" ] && [ "$( groups $agent_user | grep "\bsudo\b" )" != "" ]
-	then
-		sudo /etc/init.d/ogp_agent ${1:-''}
-		exit
-	else
-		echo "Permission denied."
-		exit
-	fi
-fi
-
-start() {
-	echo -n "Starting OGP Agent: "
-	if [ -e "$agent_dir/ogp_agent_run.pid" ]; then
-		PID=`cat $agent_dir/ogp_agent_run.pid`
-		RET=$(kill -s 0 $PID &> /dev/null; echo $?)
-		if [ $RET -eq 0 ]; then
-			echo -n "already running."
-			failure
-			echo
-			return 1
-		fi
-	fi
-	
-	# Lets the agent user to use sudo to enable FTP accounts and use renice and taskset.
-	if [ "$( cat /etc/group | grep "^sudo" )" == "" ]
-	then
-		groupadd sudo &> /dev/null
-	fi
-	
-	if [ "$( cat /etc/sudoers | grep "^%sudo" )" == "" ]
-	then
-		echo '%sudo		ALL=(ALL)	   ALL' >> /etc/sudoers
-	fi
-	
-	if [ "$( groups $agent_user | grep "\bsudo\b" )" == "" ]
-	then
-		usermod -a -G sudo $agent_user &> /dev/null
-	fi
-	
-	group=`groups $agent_user | awk '{ print $3 }'`; 
-	chown -Rf $agent_user:$group $agent_dir &> /dev/null
-	
-	# Lets the agent user to attach screens.
-	if [ "$( groups $agent_user | grep "\btty\b" )" == "" ]
-	then
-		usermod -a -G tty $agent_user &> /dev/null
-	fi
-	chmod g+rw /dev/pts/* &> /dev/null
-	chmod g+rw /dev/tty* &> /dev/null
-	
-	# Give access for ifconfig to the user of the agent
-	if [ ! -f /usr/bin/ifconfig ]
-	then
-		ln -s /sbin/ifconfig /usr/bin/ifconfig
-	fi
-	
-	# Check the FTP status
-	if [ -f "/etc/init.d/pure-ftpd" ]
-	then
-		if [ "$( cat /etc/pure-ftpd/pure-ftpd.conf | grep "^PureDB" )" == "" ]
-		then
-			sed -i 's|.*PureDB.*|PureDB /etc/pure-ftpd/pureftpd.pdb|' /etc/pure-ftpd/pure-ftpd.conf
-			sed -i 's|.*BrokenClientsCompatibility.*|BrokenClientsCompatibility yes|' /etc/pure-ftpd/pure-ftpd.conf
-			sed -i 's|.*NoAnonymous.*|NoAnonymous yes|' /etc/pure-ftpd/pure-ftpd.conf
-			sed -i 's|.*PAMAuthentication.*|PAMAuthentication no|' /etc/pure-ftpd/pure-ftpd.conf
-			sed -i 's|.*CreateHomeDir.*|CreateHomeDir yes|' /etc/pure-ftpd/pure-ftpd.conf
-			pure-pw mkdb &> /dev/null
-			service pure-ftpd restart &> /dev/null
-		fi
-
-		PURE_STATUS=`service pure-ftpd status`
-		if test $? -ne 0
-		then
-			service pure-ftpd restart &> /dev/null
-		fi
-	fi
-	
-	cd $agent_dir
-	su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user &> $agent_dir/ogp_agent.svc &
-	echo -n "started successfully."
-	success
-	bold=`tput bold`
-	normal=`tput sgr0`
-	echo
-	echo "Use ${bold}sudo su -c 'screen -S ogp_agent -r' $agent_user${normal} to attach the agent screen,"
-	echo "and ${bold}ctrl+A+D${normal} to detach it."
-	return 0
-}
-
-stop() {
-	# Stop daemon
-	echo -n "Stopping OGP Agent: "
-	if [ -f $agent_dir/ogp_agent_run.pid ]
-	then
-		PID=`cat $agent_dir/ogp_agent_run.pid`
-		RET=$(kill $PID &> /dev/null; echo $?)
-		if [ $RET -ne 0 ]; then
-			echo -n "not running."
-			failure
-		else
-			echo -n "stopped successfully."
-			success
-		fi
-	else
-		echo -n "PID file not found ($agent_dir/ogp_agent_run.pid)"
-		failure
-	fi
-	echo
-	return 0
-}
-
-case "$1" in
-	start)
-	start
-	RETVAL=$?
-	;;
-	stop)
-	stop
-	RETVAL=$?
-	;;
-	restart)
-	stop
-	${!}
-	start
-	RETVAL=$?
-	;;
- 	*)
-	echo "Usage: service ogp_agent start|stop|restart"
-	RETVAL=1
-	echo
-	;;
-esac
-exit $RETVAL