watchcat: run through shfmt

Cosmetic fixes mainly.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2021-08-08 20:03:54 -07:00
parent b4a4aab5fa
commit 933de68f3f
4 changed files with 196 additions and 196 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=watchcat
PKG_VERSION:=1
PKG_RELEASE:=12
PKG_RELEASE:=13
PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
PKG_LICENSE:=GPL-2.0

View File

@ -19,11 +19,11 @@ append_string() {
time_to_seconds() {
time=$1
{ [ "$time" -ge 1 ] 2>/dev/null && seconds="$time"; } ||
{ [ "${time%s}" -ge 1 ] 2>/dev/null && seconds="${time%s}"; } ||
{ [ "${time%m}" -ge 1 ] 2>/dev/null && seconds=$((${time%m} * 60)); } ||
{ [ "${time%h}" -ge 1 ] 2>/dev/null && seconds=$((${time%h} * 3600)); } ||
{ [ "${time%d}" -ge 1 ] 2>/dev/null && seconds=$((${time%d} * 86400)); }
{ [ "$time" -ge 1 ] 2> /dev/null && seconds="$time"; } ||
{ [ "${time%s}" -ge 1 ] 2> /dev/null && seconds="${time%s}"; } ||
{ [ "${time%m}" -ge 1 ] 2> /dev/null && seconds=$((${time%m} * 60)); } ||
{ [ "${time%h}" -ge 1 ] 2> /dev/null && seconds=$((${time%h} * 3600)); } ||
{ [ "${time%d}" -ge 1 ] 2> /dev/null && seconds=$((${time%d} * 86400)); }
echo $seconds
unset seconds

View File

@ -40,8 +40,8 @@ reboot_now() {
[ "$1" -ge 1 ] && {
sleep "$1"
echo 1 >/proc/sys/kernel/sysrq
echo b >/proc/sysrq-trigger # Will immediately reboot the system without syncing or unmounting your disks.
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger # Will immediately reboot the system without syncing or unmounting your disks.
}
}
@ -109,12 +109,12 @@ watchcat_monitor_network() {
for host in $ping_hosts; do
if [ "$iface" != "" ]; then
ping_result="$(
ping -I "$iface" -s "$ping_size" -c 1 "$host" &>/dev/null
ping -I "$iface" -s "$ping_size" -c 1 "$host" &> /dev/null
echo $?
)"
else
ping_result="$(
ping -s "$ping_size" -c 1 "$host" &>/dev/null
ping -s "$ping_size" -c 1 "$host" &> /dev/null
echo $?
)"
fi
@ -179,12 +179,12 @@ watchcat_ping() {
for host in $ping_hosts; do
if [ "$iface" != "" ]; then
ping_result="$(
ping -I "$iface" -s "$ping_size" -c 1 "$host" &>/dev/null
ping -I "$iface" -s "$ping_size" -c 1 "$host" &> /dev/null
echo $?
)"
else
ping_result="$(
ping -s "$ping_size" -c 1 "$host" &>/dev/null
ping -s "$ping_size" -c 1 "$host" &> /dev/null
echo $?
)"
fi