fixed installer
This commit is contained in:
parent
05b7d2e464
commit
3d93d01cd1
27 changed files with 996 additions and 1665 deletions
|
|
@ -7,16 +7,16 @@ agent_user=OGP_USER
|
|||
|
||||
# Start function.
|
||||
start() {
|
||||
echo "Starting OGP Agent..."
|
||||
echo "Starting GSP 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 &
|
||||
su -c "screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user &> $agent_dir/gsp_agent.svc &
|
||||
echo
|
||||
}
|
||||
|
||||
# Stop function.
|
||||
stop() {
|
||||
echo "Stopping OGP Agent..."
|
||||
kill `cat $agent_dir/ogp_agent_run.pid`
|
||||
echo "Stopping GSP Agent..."
|
||||
kill `cat $agent_dir/gsp_agent_run.pid`
|
||||
}
|
||||
|
||||
restart() {
|
||||
|
|
@ -35,7 +35,7 @@ case $1 in
|
|||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ogp_agent {start|stop|restart}"
|
||||
echo "Usage: gsp_agent {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
# 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
|
||||
# Short-Description: Start and stop the GSP Agent
|
||||
# Description: Start and stop the GSP Agent
|
||||
### END INIT INFO
|
||||
#
|
||||
|
||||
|
|
@ -26,9 +26,9 @@ then
|
|||
fi
|
||||
|
||||
start() {
|
||||
if [ -e "$agent_dir/ogp_agent_run.pid" ]
|
||||
if [ -e "$agent_dir/gsp_agent_run.pid" ]
|
||||
then
|
||||
pid=$(cat $agent_dir/ogp_agent_run.pid)
|
||||
pid=$(cat $agent_dir/gsp_agent_run.pid)
|
||||
out=$(kill -0 $pid > /dev/null 2>&1)
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
|
|
@ -90,14 +90,14 @@ start() {
|
|||
fi
|
||||
|
||||
cd $agent_dir
|
||||
out=$(su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user >/dev/null 2>&1)
|
||||
out=$(su -c "screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user >/dev/null 2>&1)
|
||||
return 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ -e "$agent_dir/ogp_agent_run.pid" ]
|
||||
if [ -e "$agent_dir/gsp_agent_run.pid" ]
|
||||
then
|
||||
pid=$(cat $agent_dir/ogp_agent_run.pid)
|
||||
pid=$(cat $agent_dir/gsp_agent_run.pid)
|
||||
kill -0 $pid > /dev/null 2>&1
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
|
|
@ -126,7 +126,7 @@ case "${1:-''}" in
|
|||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: service ogp_agent start|stop|restart"
|
||||
echo "Usage: service gsp_agent start|stop|restart"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -12,14 +12,13 @@ depend() {
|
|||
}
|
||||
|
||||
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"
|
||||
ebegin "Starting GSP Agent"
|
||||
start-stop-daemon --verbose --chdir $agent_dir --start --background --user $agent_user -e PWD="$agent_dir" --exec screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid
|
||||
eend $? "Failed to start GSP Agent"
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping OGP Agent"
|
||||
start-stop-daemon --stop --quiet --pidfile $agent_dir/ogp_agent_run.pid
|
||||
eend $? "Failed to stop OGP Agent"
|
||||
ebegin "Stopping GSP Agent"
|
||||
start-stop-daemon --stop --quiet --pidfile $agent_dir/gsp_agent_run.pid
|
||||
eend $? "Failed to stop GSP Agent"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Startup/shutdown script for the OGP Agent.
|
||||
# Startup/shutdown script for the GSP Agent.
|
||||
#
|
||||
# Linux chkconfig stuff:
|
||||
#
|
||||
# chkconfig: 2345 88 10
|
||||
# description: Startup/shutdown script for the OGP Agent
|
||||
# description: Startup/shutdown script for the GSP Agent
|
||||
|
||||
agent_dir=OGP_AGENT_DIR
|
||||
agent_user=OGP_USER
|
||||
service=ogp_agent
|
||||
service=gsp_agent
|
||||
|
||||
# Source function library.
|
||||
if [ -f /etc/rc.d/init.d/functions ] ; then
|
||||
|
|
@ -23,7 +23,7 @@ if [ "$( whoami )" != "root" ]
|
|||
then
|
||||
if [ -f "/usr/bin/sudo" ] && [ "$( groups $agent_user | grep "\bsudo\b" )" != "" ]
|
||||
then
|
||||
sudo /etc/init.d/ogp_agent ${1:-''}
|
||||
sudo /etc/init.d/gsp_agent ${1:-''}
|
||||
exit
|
||||
else
|
||||
echo "Permission denied."
|
||||
|
|
@ -32,9 +32,9 @@ then
|
|||
fi
|
||||
|
||||
start() {
|
||||
echo -n "Starting OGP Agent: "
|
||||
if [ -e "$agent_dir/ogp_agent_run.pid" ]; then
|
||||
PID=`cat $agent_dir/ogp_agent_run.pid`
|
||||
echo -n "Starting GSP Agent: "
|
||||
if [ -e "$agent_dir/gsp_agent_run.pid" ]; then
|
||||
PID=`cat $agent_dir/gsp_agent_run.pid`
|
||||
RET=$(kill -s 0 $PID &> /dev/null; echo $?)
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo -n "already running."
|
||||
|
|
@ -100,22 +100,22 @@ start() {
|
|||
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 &
|
||||
su -c "screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user &> $agent_dir/gsp_agent.svc &
|
||||
echo -n "started successfully."
|
||||
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 "Use ${bold}sudo su -c 'screen -S gsp_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 ]
|
||||
echo -n "Stopping GSP Agent: "
|
||||
if [ -f $agent_dir/gsp_agent_run.pid ]
|
||||
then
|
||||
PID=`cat $agent_dir/ogp_agent_run.pid`
|
||||
PID=`cat $agent_dir/gsp_agent_run.pid`
|
||||
RET=$(kill $PID &> /dev/null; echo $?)
|
||||
if [ $RET -ne 0 ]; then
|
||||
echo -n "not running."
|
||||
|
|
@ -123,7 +123,7 @@ stop() {
|
|||
echo -n "stopped successfully."
|
||||
fi
|
||||
else
|
||||
echo -n "PID file not found ($agent_dir/ogp_agent_run.pid)"
|
||||
echo -n "PID file not found ($agent_dir/gsp_agent_run.pid)"
|
||||
fi
|
||||
echo
|
||||
return 0
|
||||
|
|
@ -145,7 +145,7 @@ case "$1" in
|
|||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: service ogp_agent start|stop|restart"
|
||||
echo "Usage: service gsp_agent start|stop|restart"
|
||||
RETVAL=1
|
||||
echo
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue