Add more checl-scripts

This commit is contained in:
2017-02-21 01:19:22 +01:00
parent ad7a77eb5a
commit a97dd2781e
12 changed files with 687 additions and 0 deletions

28
check_samba4_service.sh Executable file
View 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