devxlogo

Auto Start the DNS Service in Linux

Auto Start the DNS Service in Linux

When the DNS service has stopped, use this code to start it automatically.

 #! /bin/bashdns_pid=`ps -ax|grep "named -u named" |grep -v grep |awk '{print $2}'`if test "x$dns_pid" = "x" ; then/etc/init.d/named restartecho `date` << /home/admin/script/dns.logecho "DNS Started" << /home/admin/script/dns.logfi//On the Above Shell Script save into a file name called Ex:- dnsfile//chmod 755 dnsfile//add that file path in /etc/crontab file like//*  * * * * root /dnsfile
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist