Add more checl-scripts
This commit is contained in:
28
check_samba4_service.sh
Executable file
28
check_samba4_service.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#"!/usr/bin/env bash
|
||||
|
||||
PIDS=`ps aux | grep "/usr/local/samba/sbin/samba" | grep -v grep | awk '{print$2}'`
|
||||
|
||||
if [ "X${PIDS}X" = "XX" ];then
|
||||
echo -e "\n[Error]: Samba Service seems to be down. Try to (re)start .."
|
||||
/etc/init.d/samba4 stop > /dev/null 2>&1
|
||||
/etc/init.d/samba4 start > /dev/null
|
||||
sleep 2
|
||||
NEW_PIDS=`ps aux | grep "/usr/local/samba/sbin/samba" | grep -v grep | awk '{print$2}'`
|
||||
if [ "X${NEW_PIDS}X" = "XX" ]; then
|
||||
echo -e ""
|
||||
echo -e "\t[Error]: Restarting samba services failed !!"
|
||||
echo -e "\n\t[Error]: Restarting samba services failed !!\n"
|
||||
echo -e ""
|
||||
else
|
||||
PIDS=""
|
||||
for pid in $NEW_PIDS ; do
|
||||
PIDS="$PIDS $pid"
|
||||
done
|
||||
echo -e
|
||||
echo -e "\tI have restarted the samba services. The new PIDs are $PIDS"
|
||||
echo -e
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user