-
Notifications
You must be signed in to change notification settings - Fork 9
/
restart
executable file
·48 lines (35 loc) · 1.22 KB
/
restart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# This is not normally called, only when suspecting that the
# suibase-daemon is not responding.
#
# Source '__globals.sh'.
SUIBASE_DIR="$HOME/suibase"
SCRIPT_COMMON_CALLER="$(readlink -f "$0")"
WORKDIR="none"
main() {
# Detect if suibase is not installed!
if [ ! -d "$SUIBASE_DIR" ]; then
echo "ERROR: suibase is not installed! Check https://suibase.io/how-to/install"
exit 1
fi
# shellcheck source=SCRIPTDIR/scripts/common/__globals.sh
source "$SUIBASE_DIR/scripts/common/__globals.sh" "$SCRIPT_COMMON_CALLER" "$WORKDIR"
trap cleanup EXIT
# shellcheck source=SCRIPTDIR/scripts/common/__apps.sh
source "$SUIBASE_DIR/scripts/common/__apps.sh"
# shellcheck source=SCRIPTDIR/scripts/common/__suibase-daemon.sh
source "$SUIBASE_DIR/scripts/common/__suibase-daemon.sh"
exit_if_not_installed
exit_if_deps_missing
# Block users from running any concurrent CLI commands.
cli_mutex_lock "suibase_daemon"
update_SUIBASE_DAEMON_PID_var
local _OLD_PID=$SUIBASE_DAEMON_PID
start_suibase_daemon_as_needed
if [ "$_OLD_PID" == "$SUIBASE_DAEMON_PID" ]; then
restart_suibase_daemon
# Check for any JSON-RPC up, except for localnet.
wait_for_json_rpc_up "exclude-localnet"
fi
}
main "$@"