Установка на FreeBSD

Материал из BiTel WiKi

Перейти к: навигация, поиск

Пока есть такой ресурс : http://behterev.su/index.php?pa=articles


Содержание

Второй вариант rc скриптов

В этом варианте весь bgbilling находится в /usr/local/bgbilling и BGBillingServer в /usr/local/bgbilling/server. Заведен пользователь bg с home директорией /usr/local/bgbilling и соответсвенно все части bgbilling запускаются от этого пользователя. rc скрипты кидаем в /usr/local/etc/rc.d/ и ставим атрибут исполнения. в /etc/rc.conf добавляем:

bgserver

bgserver_enable="YES"

дополнительно можно указать:

bgserver_java="<путь до нужной java машины>"
bgserver_pid="<путь и имя pid фала>"
bgserver_chdir="<путь home BGBillingServer>"
bgserver_users="<имя пользователя от которого будет запускатся BGBillingServer>"


#!/bin/sh 
# 
# PROVIDE: bgserver 
# REQUIRE: DAEMON mysql
# KEYWORD: shutdown 
# 
# Add the following line to /etc/rc.conf to enable trac: 
#  bgserver_enable="YES" 
# 

. "/etc/rc.subr" 


bgserver_enable=${bgserver_enable:-"NO"}
bgserver_java=${bgserver_java:-"/usr/local/openjdk6"}
bgserver_pid=${bgserver_pid:-"/var/run/bgbilling/bgserver.pid"}
bgserver_chdir=${bgbilling_chdir:-"/usr/local/bgbilling/server"}
bgserver_users=${bgserver_user:-"bg"}
CLASSPATH=${bgserver_chdir}:${bgserver_chdir}/lib/*

name=bgserver 
rcvar=`set_rcvar`

foo="$bgserver_java/bin/java -Dapp.name=BGBillingServer -Dnetworkaddress.cache.ttl=3600 -Xmx512m -cp $CLASSPATH ru.bitel.common.bootstrap.Boot bitel.billing.server.Server start > ./log/server.out 2>&1"
boo="$bgserver_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp $CLASSPATH bitel.billing.server.Server stop"

stop_cmd="bg_stop"

bg_stop()
{
        rc_pid=$(check_pidfile $pidfile $procname)
        if [ -z "$rc_pid" ]; then
                [ -n "$rc_fast" ] && return 0
                _run_rc_notrunning
                return 1
        fi
        echo 'Stopping bgbilling.'
        if $boo 2>/dev/null; then
                wait_for_pids $rc_pid
        else
                echo -n 'bgbilling failed, trying kill: '
                kill -TERM $rc_pid
                wait_for_pids $rc_pid
        fi
}

load_rc_config $name 

pidfile=${bgserver_pid} 
command=/usr/sbin/daemon 
command_args="-p ${pidfile} -u ${bgserver_users} ${foo}"
procname=$bgserver_java/bin/java

run_rc_command "$1"


bgdataloader

настройки в rc.conf по аналогии с bgserver

#!/bin/sh 
# 
# PROVIDE: bgdataloader 
# REQUIRE: DAEMON mysql
# KEYWORD: shutdown 
# 
# Add the following line to /etc/rc.conf to enable trac: 
#  bgdataloader_enable="YES" 
# 

. "/etc/rc.subr" 


bgdataloader_enable=${bgdataloader_enable:-"NO"}
bgdataloader_java=${bgdataloader_java:-"/usr/local/openjdk6"}
bgdataloader_pid=${bgdataloader_pid:-"/var/run/bgbilling/bgdataloader.pid"}
bgdataloader_chdir=${bgdataloader_chdir:-"/usr/local/bgbilling/server"}
bgdataloader_users=${bgdataloader_user:-"bg"}
CLASSPATH=${bgdataloader_chdir}:${bgdataloader_chdir}/lib/*

name=bgdataloader 
rcvar=`set_rcvar`

foo="$bgdataloader_java/bin/java -Dapp.name=BGDataLoader -Dnetworkaddress.cache.ttl=3600 -Xmx256m -cp ${CLASSPATH} ru.bitel.common.bootstrap.Boot bitel.billing.server.DataLoader -estart > ./log/dataloader.out 2>&1"
boo="$bgdataloader_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp ${CLASSPATH} bitel.billing.server.DataLoader -estop"

stop_cmd="bg_stop"

bg_stop()
{
        rc_pid=$(check_pidfile $pidfile $procname)
        if [ -z "$rc_pid" ]; then
                [ -n "$rc_fast" ] && return 0
                _run_rc_notrunning
                return 1
        fi
        echo 'Stopping bgbilling.'
        if $boo 2>/dev/null; then
                wait_for_pids $rc_pid
        else
                echo -n 'bgbilling failed, trying kill: '
                kill -TERM $rc_pid
                wait_for_pids $rc_pid
        fi
}

load_rc_config $name 

pidfile=${bgdataloader_pid} 
command=/usr/sbin/daemon 
command_args="-p ${pidfile} ${foo}"
procname=$bgdataloader_java/bin/java

run_rc_command "$1"

bgscheduler

настройки в rc.conf по аналогии с bgserver

#!/bin/sh 
# 
# PROVIDE: bgscheduler 
# REQUIRE: DAEMON mysql
# KEYWORD: shutdown 
# 
# Add the following line to /etc/rc.conf to enable trac: 
#  bgscheduler_enable="YES" 
# 

. "/etc/rc.subr" 


bgscheduler_enable=${bgscheduler_enable:-"NO"}
bgscheduler_java=${bgscheduler_java:-"/usr/local/openjdk6"}
bgscheduler_pid=${bgscheduler_pid:-"/var/run/bgbilling/bgscheduler.pid"}
bgscheduler_chdir=${bgscheduler_chdir:-"/usr/local/bgbilling/server"}
bgscheduler_users=${bgscheduler_user:-"bg"}
CLASSPATH=${bgscheduler_chdir}:${bgscheduler_chdir}/lib/*

name=bgscheduler 
rcvar=`set_rcvar`

foo="$bgscheduler_java/bin/java -Dapp.name=BGScheduler -Xmx256m -cp ${CLASSPATH} ru.bitel.common.bootstrap.Boot bitel.billing.server.TaskExecuter -estart > ./log/scheduler.out 2>&1"
boo="$bgscheduler_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp ${CLASSPATH} bitel.billing.server.TaskExecuter -estop"

stop_cmd="bg_stop"

bg_stop()
{
        rc_pid=$(check_pidfile $pidfile $procname)
        if [ -z "$rc_pid" ]; then
                [ -n "$rc_fast" ] && return 0
                _run_rc_notrunning
                return 1
        fi
        echo 'Stopping bgbilling.'
        if $boo 2>/dev/null; then
                wait_for_pids $rc_pid
        else
                echo -n 'bgbilling failed, trying kill: '
                kill -TERM $rc_pid
                wait_for_pids $rc_pid
        fi
}

load_rc_config $name 

pidfile=${bgscheduler_pid} 
command=/usr/sbin/daemon 
command_args="-p ${pidfile} ${foo}"
procname=$bgscheduler_java/bin/java

run_rc_command "$1"

FAQ по FreeBSD

Личные инструменты