mirror of
https://github.com/unraid/webgui.git
synced 2026-02-07 09:29:18 -06:00
Change function
- return `1` if daemon is running and return `0` if it is not running
This commit is contained in:
@@ -27,10 +27,10 @@ sshd_running(){
|
||||
for pid in $(pgrep -f $SSHD); do
|
||||
# check if a sshd is running on host system
|
||||
if ! grep -qE '/docker/|/lxc/' /proc/$pid/cgroup; then
|
||||
return 1
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
sshd_build(){
|
||||
@@ -48,7 +48,7 @@ sshd_build(){
|
||||
sshd_start(){
|
||||
log "Starting $DAEMON..."
|
||||
local REPLY
|
||||
if ! sshd_running; then
|
||||
if sshd_running; then
|
||||
REPLY="Already started"
|
||||
else
|
||||
# make sure ssh dir exists on flash
|
||||
@@ -63,14 +63,14 @@ sshd_start(){
|
||||
sshd_build
|
||||
# start daemon
|
||||
run $SSHD
|
||||
if ! sshd_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||
if sshd_running; then REPLY="Started"; else REPLY="Failed"; fi
|
||||
fi
|
||||
log "$DAEMON... $REPLY."
|
||||
}
|
||||
|
||||
sshd_stop(){
|
||||
local REPLY
|
||||
if sshd_running; then
|
||||
if ! sshd_running; then
|
||||
REPLY="Already stopped"
|
||||
else
|
||||
log "Stopping $DAEMON..."
|
||||
@@ -81,7 +81,7 @@ sshd_stop(){
|
||||
kill $pid
|
||||
fi
|
||||
done
|
||||
if sshd_running; then
|
||||
if ! sshd_running; then
|
||||
REPLY="Stopped"
|
||||
else
|
||||
REPLY="Failed"
|
||||
@@ -125,7 +125,7 @@ sshd_update(){
|
||||
}
|
||||
|
||||
sshd_status(){
|
||||
if ! sshd_running; then
|
||||
if sshd_running; then
|
||||
echo "$DAEMON is currently running."
|
||||
else
|
||||
echo "$DAEMON is not running."
|
||||
|
||||
Reference in New Issue
Block a user