Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 59 lines (48 sloc) 1.68 KB
#!/bin/sh
APP=${2}
ARG1=${3}
ARG2=${4}
ARG3=${5}
# globals
HOSTNAME=`case \`uname\` in Darwin ) echo \`hostname\`;; * ) echo \`hostname --fqdn\`;; esac`
get_root() {
echo `erl -eval 'io:format("~s~n", [case code:lib_dir("log_roller_server") of {error,_} -> ""; S -> S end])' -s init stop -noshell`
}
get_sasl() {
echo "-sasl sasl_error_logger false -sasl errlog_type all -sasl error_logger_mf_dir \"/var/log/log_roller\" -sasl error_logger_mf_maxbytes 1048576 -sasl error_logger_mf_maxfiles 1"
}
dev_server() {
erl -pa ebin -name log_roller@`hostname` +W w +A 1 -config priv/dev -boot log_roller_server
}
console_server() {
erl -name log_roller@$HOSTNAME +W w +A 1 -config $(get_root)/priv/log_roller -boot log_roller_server $(get_sasl)
}
start_server() {
erl -detached -name log_roller@$HOSTNAME +W w +A 1 -config $(get_root)/priv/log_roller -boot log_roller_server -noshell $(get_sasl)
}
dev(){
if [ -z "${APP}" ] || [ -z "`type dev_${APP} 2>/dev/null`" ]; then
echo -e "Invalid application for dev: ${APP}"
else
dev_${APP}
fi
}
console(){
if [ -z "${APP}" ] || [ -z "`type console_${APP} 2>/dev/null`" ]; then
echo -e "Invalid application for console: ${APP}"
else
console_${APP}
fi
}
start(){
if [ -z "${APP}" ] || [ -z "`type start_${APP} 2>/dev/null`" ]; then
echo "${APP} is not a valid application"
else
start_${APP}
fi
}
if [ -z "${1}" ] || [ -z "`type $1 2>/dev/null`" ]; then
echo "usage:\t`basename $0` dev server\n\t`basename $0` console server\n\t`basename $0` start server\n\t`basename $0`"
else
${1}
fi