Skip to content

Commit f0191b3

Browse files
committed
Create check.sh
1 parent 1d83b8f commit f0191b3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

check.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
SERVICE_NAME="$1"
4+
5+
if [ -z "$SERVICE_NAME" ]; then
6+
echo "Usage: $0 <service_name>"
7+
exit 1
8+
fi
9+
10+
STATUS=$(/opt/etc/init.d/rc.unslung check "$SERVICE_NAME")
11+
12+
echo "$STATUS" | grep -q "dead"
13+
if [ $? -eq 0 ]; then
14+
echo "$SERVICE_NAME is dead. Attempting to start..."
15+
/opt/etc/init.d/rc.unslung start "$SERVICE_NAME"
16+
fi

0 commit comments

Comments
 (0)