Skip to content

Commit 06e17fa

Browse files
author
Thomas Arts
committed
Add pre-start hook for checking node not running at start
1 parent 1e6f181 commit 06e17fa

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

rebar.config

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@
8686
{template, "rel/files/riak-repl", "bin/riak-repl"},
8787
{template, "rel/files/check_riak_config", "bin/check_riak_config"},
8888

89-
{copy, "rel/files/check_ulimit", "bin/hooks/prestart/check_ulimit"}
89+
{copy, "rel/files/check_ulimit", "bin/hooks/check_ulimit"},
90+
{copy, "rel/files/riak_not_running", "bin/hooks/riak_not_running"}
91+
9092
]},
9193

9294
{generate_start_script, true},
@@ -98,14 +100,15 @@
98100
{chkconfig, "riak-chkconfig"}
99101
]},
100102

101-
{extended_start_script_hooks, [
102-
{pre_start, [
103-
{custom, "hooks/prestart/check_ulimit"}
104-
]},
105-
{post_start, [
106-
{wait_for_process, riak_core_node_watcher}
107-
]}
108-
]}
103+
104+
{extended_start_script_hooks,
105+
[ {pre_start,
106+
[{custom, "hooks/riak_not_running"},
107+
{custom, "hooks/check_ulimit"}]},
108+
{post_start,
109+
[{wait_for_process, riak_core_node_watcher}
110+
]}
111+
]}
109112
]}.
110113

111114
{profiles, [

rel/files/riak_not_running

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# -*- tab-width:4;indent-tabs-mode:nil -*-
3+
# ex: ts=4 sw=4 et
4+
5+
if relx_nodetool "ping" > /dev/null; then
6+
echo "Node is already running!"
7+
exit 1
8+
fi

0 commit comments

Comments
 (0)