diff --git a/contrib/guam.sysvinit b/contrib/guam.sysvinit new file mode 100644 index 0000000..3003a23 --- /dev/null +++ b/contrib/guam.sysvinit @@ -0,0 +1,103 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +name=`basename $0` + +start_cmd="$name start" +restart_cmd="$name restart" +stop_cmd="$name stop" +ping_cmd="$name ping" +user="" + + +get_pid() { + cat "$pid_file" +} + +is_running() { + $ping_cmd > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + if [ -z "$user" ]; then + $start_cmd + else + sudo -u "$user" $start_cmd + fi + sleep 2 + + for i in {1..10} + do + if is_running; then + break; + fi + + echo -n "." + sleep 1 + done + + if ! is_running; then + echo "Unable to start" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + $stop_cmd + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $restart_cmd + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/rel/reltool.config b/rel/reltool.config index 298f1ac..1ece54f 100644 --- a/rel/reltool.config +++ b/rel/reltool.config @@ -1,51 +1,51 @@ %% -*- mode: erlang -*- %% ex: ft=erlang {sys, [ {lib_dirs, ["../deps"]}, {erts, [{mod_cond, derived}, {app_file, strip}]}, {app_file, strip}, - {rel, "kolab_guam", "0.8", + {rel, "kolab_guam", "0.9", [ kernel, stdlib, sasl, compiler, syntax_tools, goldrush, lager, lager_syslog, crypto, kolab_guam ]}, {rel, "start_clean", "", [ kernel, stdlib ]}, {boot_rel, "kolab_guam"}, {profile, embedded}, {incl_cond, derived}, {excl_archive_filters, [".*"]}, %% Do not archive built libs {excl_sys_filters, ["^bin/(?!start_clean.boot)", "^erts.*/bin/(dialyzer|typer)", "^erts.*/(doc|info|include|lib|man|src)"]}, {excl_app_filters, ["\.gitignore"]}, {app, kolab_guam, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../apps/kolab_guam"}]} ]}. {target_dir, "kolab_guam"}. {overlay, [ {mkdir, "log/sasl"}, {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, {copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"}, {copy, "kolab_guam/bin/start_clean.boot", "\{\{erts_vsn\}\}/bin/start_clean.boot"}, {copy, "files/kolab_guam", "bin/kolab_guam"}, {copy, "files/kolab_guam.cmd", "bin/kolab_guam.cmd"}, {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, %% Following line may be safely removed in new projects {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"}, {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"}, {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"} ]}.