diff options
author | Craig Andrews <candrews@integralblue.com> | 2017-10-03 10:52:02 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2017-10-03 19:49:03 -0400 |
commit | 3f4db620484e777265a7e5f0cfe10ba840f7eefd (patch) | |
tree | 90b2584d695f4d56f0783b253e5aba587456593f | |
parent | 57efe2e5062cc8a2177fd8f745d60631e008b831 (diff) |
Eliminate bashisms in openrc script
-rw-r--r-- | system/netdata-openrc.in | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/system/netdata-openrc.in b/system/netdata-openrc.in index 465e1232cc..5c4eafa57c 100644 --- a/system/netdata-openrc.in +++ b/system/netdata-openrc.in @@ -38,13 +38,13 @@ depend() { } start_post() { - if [[ ! -f @sysconfdir_POST@/netdata/netdata.conf ]]; then + if [ ! -f @sysconfdir_POST@/netdata/netdata.conf ]; then ebegin "Downloading default configuration to @sysconfdir_POST@/netdata/netdata.conf" sleep 2 curl -s -o @sysconfdir_POST@/netdata/netdata.conf.new "${NETDATA_CONFIG_URL}" ret=$? - if [[ $ret -eq 0 && -s @sysconfdir_POST@/netdata/netdata.conf.new ]]; then - mv @sysconfdir_POST@/netdata/netdata.conf{.new,} + if [ $ret -eq 0 && -s @sysconfdir_POST@/netdata/netdata.conf.new ]; then + mv @sysconfdir_POST@/netdata/netdata.conf.new @sysconfdir_POST@/netdata/netdata.conf else ret=1 rm @sysconfdir_POST@/netdata/netdata.conf.new 2>/dev/null @@ -57,20 +57,20 @@ stop_post() { local result ret=0 count=0 sigkill=0 ebegin "Waiting for netdata to save its database" - while [[ -f "${pidfile}" ]]; do - if [[ $count -gt ${NETDATA_WAIT_EXIT_TIMEOUT} ]]; then + while [ -f "${pidfile}" ]; do + if [ $count -gt ${NETDATA_WAIT_EXIT_TIMEOUT} ]; then sigkill=1 break fi - count=$[count + 1] + count=$((count + 1)) kill -0 $(cat ${pidfile}) 2>/dev/null ret=$? test $ret -eq 0 && sleep 1 done eend $sigkill - if [[ $sigkill -eq 1 && -f "${pidfile}" ]]; then + if [ $sigkill -eq 1 && -f "${pidfile}" ]; then ebegin "Netdata is taking too long to exit, forcing it to quit" kill -SIGKILL $(cat ${pidfile}) 2>/dev/null eend $? |