Skip to content

Commit

Permalink
Keep Redis if you enabled it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefar77 committed Mar 6, 2020
1 parent 093cb75 commit ebdb2ff
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
6 changes: 3 additions & 3 deletions bin/cbsdsh/Makefile
Expand Up @@ -6,7 +6,7 @@ SHSRCS= about.c alias.c arith_yacc.c arith_yylex.c cbsdhistory.c cbsd_fwatch.c c
mystring.c options.c output.c parser.c printf.c redir.c show.c sqlcmd.c spawn_task.c \
test.c trap.c var.c

# .SILENT:
.SILENT:

# HBSD/FBSD/TrueOS...
SHSRCS+= jail.c
Expand All @@ -22,7 +22,7 @@ SHSRCS+= contrib/ini.c cbsdcmd.c

.if defined(WITH_REDIS)
SHSRCS+= cbsdredis.c contrib/credis.c
CFLAGS+= -DWITH_REDIS -g
CFLAGS+= -DWITH_REDIS
.endif

.if defined(WITH_INFLUX)
Expand All @@ -46,7 +46,7 @@ NOMAN= yes

DPADD= ${LIBEDIT} ${LIBTERMCAP}
# HBSD/FBSD/TrueOS...
LDADD= -g -ledit -ltermcap -lm -pthread -ljail `pkg-config sqlite3 --libs` -lm
LDADD= -ledit -ltermcap -lm -pthread -ljail `pkg-config sqlite3 --libs` -lm
# Dfly
#LDADD= -ledit -lm -pthread `pkg-config sqlite3 --libs` -lm

Expand Down
4 changes: 1 addition & 3 deletions jailctl/jcoldmigrate
Expand Up @@ -19,8 +19,6 @@ emulator="jail" # for jname_is_multiple
jail_list=
jname_is_multiple

my_name="jcoldmigrate"

# -n "name of the tools" - show <name> in Info string, e.g: -n jexec, -n "pkg install" ...
# -o uniq_name_of_the_task (one world)
jcoldmigrate_multi_init()
Expand Down Expand Up @@ -97,7 +95,7 @@ st_time=$( ${DATE_CMD} +%s )

# Update Redis
if [ "${mod_cbsd_redis_enabled}" = "YES" -a -z "${MOD_CBSD_REDIS_DISABLED}" ]; then
cbsdredis publish cbsd_events '{"cmd":"'${my_name}'", "node":"'${nodename}'", "dest":"'${node}'", "jail":"'${jname}'", "status":1}'
cbsdredis publish cbsd_events '{"cmd":"'${CBSD_APP}'", "node":"'${nodename}'", "dest":"'${node}'", "jail":"'${jname}'", "status":1}'
fi

printf "${N1_COLOR}Coldmigrate.${N0_COLOR}"
Expand Down
4 changes: 2 additions & 2 deletions nc.subr
Expand Up @@ -342,10 +342,10 @@ dot()
{
if [ $? -ne 0 ]; then
# Update Redis
if [ "${mod_cbsd_redis_enabled}" = "YES" -a -z "${MOD_CBSD_REDIS_DISABLED}" -a -n "${my_name}" ]; then
if [ "${mod_cbsd_redis_enabled}" = "YES" -a -z "${MOD_CBSD_REDIS_DISABLED}" -a -n "${CBSD_APP}" ]; then
end_time=$( ${DATE_CMD} +%s )
diff_time=$(( end_time - st_time ))
cbsdredis publish cbsd_events '{"cmd":"'${my_name}'", "node":"'${nodename}'", "dest":"'${node}'", "jail":"'${jname}'", "status":2, "msg":"'$1'", "duration":'${diff_time}',"code":'$?'}'
cbsdredis publish cbsd_events '{"cmd":"'${CBSD_APP}'", "node":"'${nodename}'", "dest":"'${node}'", "jail":"'${jname}'", "status":2, "msg":"'$1'", "duration":'${diff_time}',"code":'$?'}'
fi

${ECHO} "${N1_COLOR}Error in $1${N0_COLOR}"
Expand Down
20 changes: 14 additions & 6 deletions sudoexec/initenv
Expand Up @@ -295,12 +295,18 @@ phase1()

phase2()
{
local _dir _ldir _rdir _file _dirhier _d platform
local _dir _ldir _rdir _file _dirhier _d platform

${ECHO} "${N1_COLOR}[Stage 2: ${N2_COLOR}build tools${N1_COLOR}]${N0_COLOR}"

platform=$( uname -s )

if [ "${cbsd_initenv_clustering_enabled}" = "1" ]; then
mod_cbsd_redis_enabled=YES
mod_cbsd_influx_enabled=YES
mod_cbsd_dbi_enabled=YES
fi

[ ! -f "${distdir}/bin/cbsdsftp" ] && ${CC_CMD} ${distdir}/bin/cbsdsftp.c -o ${distdir}/bin/cbsdsftp -lssh2 -L/usr/local/lib -I/usr/local/include
[ ! -f "${distdir}/bin/cbsdsftp6" ] && ${CC_CMD} ${distdir}/bin/cbsdsftp6.c -o ${distdir}/bin/cbsdsftp6 -lssh2 -L/usr/local/lib -I/usr/local/include
[ ! -f "${distfir}/bin/cbsdssh" ] && ${CC_CMD} ${distdir}/bin/cbsdssh.c -o ${distdir}/bin/cbsdssh -lssh2 -L/usr/local/lib -I/usr/local/include
Expand Down Expand Up @@ -384,11 +390,13 @@ phase2()
# make -C ${distdir}/bin/cbsdsh clean && make -DCBSDVERSION="${ncver}" -C ${distdir}/bin/cbsdsh
# fi
# else
if [ "${cbsd_initenv_clustering_enabled}" = "1" ]; then
make -C ${distdir}/bin/cbsdsh clean && make -DWITH_REDIS -DWITH_DBI -DWITH_INFLUX -DCBSDVERSION="${ncver}" -C ${distdir}/bin/cbsdsh
else
make -C ${distdir}/bin/cbsdsh clean && make -DCBSDVERSION="${ncver}" -C ${distdir}/bin/cbsdsh
fi
_build_options=""

[ "${mod_cbsd_redis_enabled}" = "YES" ] && _build_options="${_build_options} -DWITH_REDIS"
[ "${mod_cbsd_influx_enabled}" = "YES" ] && _build_options="${_build_options} -DWITH_INFLUX"
[ "${mod_cbsd_dbi_enabled}" = "YES" ] && _build_options="${_build_options} -DWITH_DBI"

make -C ${distdir}/bin/cbsdsh clean && make ${_build_options} -DCBSDVERSION="${ncver}" -C ${distdir}/bin/cbsdsh
# force rebuild sqlscli too to avoid possible SQLite3 link error
${CC_CMD} ${distdir}/misc/src/sqlcli.c -lsqlite3 -L/usr/local/lib -I/usr/local/include -o ${distdir}/misc/sqlcli

Expand Down
2 changes: 0 additions & 2 deletions sudoexec/jremove
Expand Up @@ -234,8 +234,6 @@ for jname in ${JLIST}; do
cbsdredis publish cbsd_events '{"cmd":"'${CBSD_APP}'", "node":"'${nodename}'", "jail":"'${jname}'", "status":0, "duration":'${diff_time}'}'
cbsdredis del "jail:${jname}"
fi
# Redis


diff_time=$( displaytime ${diff_time} )
cbsdlogger NOTICE ${CBSD_APP}: jail ${jname} removed in ${diff_time}
Expand Down

0 comments on commit ebdb2ff

Please sign in to comment.