Category Archives: Shell Script

Some Shell Scripts

Shell Script to add zone to DNS server. NS1 = ns1.example.net NS2 = ns2.example.net #!/bin/bash # check to see if the script is being run as root or not grep=`which grep` rndc=`which rndc` if [ “$(id -u)” != “0” ]; … Continue reading

Posted in Linux, Shell Script | Leave a comment

Monitor linux services using bash script

# Vi check_httpd.sh #!/bin/sh run=`ps ax | grep /usr/local/apache/bin/httpd | grep -v grep | cut -c1-5 | paste -s -` if [ “$run” ]; then echo “apache is running” > /home/admin/check_httpd.log else /usr/local/apache/bin/apachectl -k restart mail -s “Apache server restarted … Continue reading

Posted in Apache, Linux, Optimize, Shell Script | Leave a comment