Commit 646ff942 authored by nextime's avatar nextime

Fix all bash syntax errors: remove 'local' keyword from script body

- Removed 'local' from stop and status case handlers in both watchdogs
- 'local' can only be used inside functions, not in main script body
- Fixed both wssshd-watchdog and wssshc-watchdog scripts
- All bash syntax errors should now be resolved
parent dea963e9
...@@ -261,7 +261,7 @@ case "$1" in ...@@ -261,7 +261,7 @@ case "$1" in
;; ;;
stop) stop)
if [ -f "$WATCHDOG_PID_FILE" ]; then if [ -f "$WATCHDOG_PID_FILE" ]; then
local watchdog_pid=$(cat "$WATCHDOG_PID_FILE") watchdog_pid=$(cat "$WATCHDOG_PID_FILE")
# Double-check: verify the process is actually our watchdog # Double-check: verify the process is actually our watchdog
if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshd-watchdog"; then if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshd-watchdog"; then
kill "$watchdog_pid" 2>/dev/null kill "$watchdog_pid" 2>/dev/null
...@@ -277,7 +277,7 @@ case "$1" in ...@@ -277,7 +277,7 @@ case "$1" in
;; ;;
status) status)
if [ -f "$WATCHDOG_PID_FILE" ]; then if [ -f "$WATCHDOG_PID_FILE" ]; then
local watchdog_pid=$(cat "$WATCHDOG_PID_FILE") watchdog_pid=$(cat "$WATCHDOG_PID_FILE")
if kill -0 "$watchdog_pid" 2>/dev/null; then if kill -0 "$watchdog_pid" 2>/dev/null; then
# Double-check: verify the process is actually our watchdog # Double-check: verify the process is actually our watchdog
if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshd-watchdog"; then if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshd-watchdog"; then
...@@ -296,7 +296,7 @@ case "$1" in ...@@ -296,7 +296,7 @@ case "$1" in
# Also check daemon status # Also check daemon status
if is_daemon_running; then if is_daemon_running; then
local daemon_pid=$(cat "$PID_FILE") daemon_pid=$(cat "$PID_FILE")
echo "Daemon is running (PID: $daemon_pid)" echo "Daemon is running (PID: $daemon_pid)"
else else
echo "Daemon is not running" echo "Daemon is not running"
......
...@@ -261,7 +261,7 @@ case "$1" in ...@@ -261,7 +261,7 @@ case "$1" in
;; ;;
stop) stop)
if [ -f "$WATCHDOG_PID_FILE" ]; then if [ -f "$WATCHDOG_PID_FILE" ]; then
local watchdog_pid=$(cat "$WATCHDOG_PID_FILE") watchdog_pid=$(cat "$WATCHDOG_PID_FILE")
# Double-check: verify the process is actually our watchdog # Double-check: verify the process is actually our watchdog
if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshc-watchdog"; then if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshc-watchdog"; then
kill "$watchdog_pid" 2>/dev/null kill "$watchdog_pid" 2>/dev/null
...@@ -277,7 +277,7 @@ case "$1" in ...@@ -277,7 +277,7 @@ case "$1" in
;; ;;
status) status)
if [ -f "$WATCHDOG_PID_FILE" ]; then if [ -f "$WATCHDOG_PID_FILE" ]; then
local watchdog_pid=$(cat "$WATCHDOG_PID_FILE") watchdog_pid=$(cat "$WATCHDOG_PID_FILE")
if kill -0 "$watchdog_pid" 2>/dev/null; then if kill -0 "$watchdog_pid" 2>/dev/null; then
# Double-check: verify the process is actually our watchdog # Double-check: verify the process is actually our watchdog
if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshc-watchdog"; then if ps -p "$watchdog_pid" -o comm= 2>/dev/null | grep -q "wssshc-watchdog"; then
...@@ -296,7 +296,7 @@ case "$1" in ...@@ -296,7 +296,7 @@ case "$1" in
# Also check daemon status # Also check daemon status
if is_daemon_running; then if is_daemon_running; then
local daemon_pid=$(cat "$PID_FILE") daemon_pid=$(cat "$PID_FILE")
echo "Daemon is running (PID: $daemon_pid)" echo "Daemon is running (PID: $daemon_pid)"
else else
echo "Daemon is not running" echo "Daemon is not running"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment