Slide

  • LINUX

    LINUX:In 1969 AT&T made a decision to withdraw Multics and go with GECOS (General Electric Comprehensive Operating Supervisor / System), with AT & T in Bells Lab when Multics was withdrawn some of the programmers named Ken Thompson and Dennis Ritchie decided to rewrite operating system in order to support low cost computer..To Know More

    CLICK HERE

  • MICROSOFT

    MICROSOFT:Microsoft was established to develop and sell BASIC interpreters for the Altair 8800. It rose to dominate the home computer operating system market with MS-DOS in the mid-1980s,followed by the Microsoft Windows line of operating systems. To Know More

    CLICK HERE

  • CISCO

    CISCO:During the early 1980s, there was a married couple namely Len and Sandy Bosack who used to work in two different departments of computer located in Stanford University. This couple was facing problem in making their computers communicate with each other To Know More

    CLICK HERE

showinfo=1

Linux Script To Check Service


linux script to check if a service is running and start it, if it’s stopped



We will use this script to check squid service is runing or not if not runing it will start it automatically and send a mail to admin. we will run this script every 20 min using cron.

you need to create a directory so we can log things into that directory.

#mkdir  /var/log/scripts

#cd  /scripts
#vi service.sh

#!/bin/bash
service=squid
log=/var/log/scripts/servicesh.log
date=$(date)

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!! $date" > $log
else
echo "$service is not runing starting automatically $date" >> $log
/etc/init.d/$service start >> $log
mail -r proxy-1@ittables.com -s "Squid Service Status $date" "admin@ittables.com" < $log
fi


save the file and exit

#chmod +x service.sh

#crontab  -e

*/20  *  *  *  *  /scripts/service.sh

save and exit

Bow the above script will run in every 20min

Note:- to mail stuff postfix or sendmail should be configured properly.


30 comments:

  1. I am truly inspired by this online journal! Extremely clear clarification of issues is given and it is open to every living soul. I have perused your post, truly you have given this extraordinary informative data about it.
    http://www.oxicoa-health.com |

    ReplyDelete
  2. I think this is definitely an amazing project here. So much good will be coming from this project. The ideas and the work behind this will pay off so much.
    http://www.tricouhouse.com |

    ReplyDelete
  3. I have been waiting for someone to share this post. This has actually made me think and I hope to read more. Thanks a lot for sharing with us.
    www.titan-automation.com |

    ReplyDelete
  4. I've seen your awareness about this theme whenever you post it and it really gives an informational message to us readers. I am hoping that you'll continue writing this kind of blog. Thanks for sharing this information.
    ecohawaiitours.com |

    ReplyDelete
  5. This is an excellent post I seen thanks to share it. It is really what I wanted to see hope in future you will continue for sharing such a excellent post.
    leadcubetechnologies |

    ReplyDelete
  6. I just wanted to let you know that what you do really affects peoples lives and that people - like me - truly appreciate it.
    http://www.8a08.org |

    ReplyDelete
  7. Great article Lot's of information to Read...Great Man Keep Posting and update to People..Thanks 
    pandoraschmuckshop |

    ReplyDelete
  8. Hey there! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in the same niche. Your blog provided us useful information to work on. You have done a extraordinary job!
    Business Growth |

    ReplyDelete
  9. Oh that poster, yes I know it from the Gold edition of Gothic 2, good choice!
    http://www.liveithealthyforlife.com |

    ReplyDelete
  10. I just wanted to let you know that what you do really affects pemedicareccr.com |

    oples lives and that people - like me - truly appreciate it.

    ReplyDelete
  11. A good point Ralph, but I believe people are going to have a hard time defending prejudice when the possibility of answering certain kinds of questions with much greater precision increases
    essex-x-tech.com |

    ReplyDelete
  12. Shipped very quickly, items as described, very pleasant experience! Thanks!
    www.autotransportandmore.com |

    ReplyDelete
  13. Illy Italian espresso paired with an old west feel. Great sandwiches and of course wifi make sitting down on our couch a comfy and productive experience just about any time of day! And for those of you without a laptop, no need to worry we've got you covered with a couple of free access computers too!
    Food Managemet |

    ReplyDelete
  14. Fantastic work and very well-written article. I will recommend reading it to all my friends
    www.autoscoloris.com |

    ReplyDelete
  15. Having read this I believed it was rather informative. I appreciate you finding the time and effort to put this informative article together. I once again find myself spending a lot of time both reading and posting comments. But so what, it was still worth it!
    http://www.greenupcountyhealth.com |

    ReplyDelete
  16. Your blog is really nice. If I may share some insight, traffic studies on blogs show most people read blogs on Mondays. So it should encourage blogger to write new updates over the weekend primarily.
    greenhouse-agency |

    ReplyDelete
  17. Low charges with packers and movers chennai service. Top Fooglepackers.com are process the perfect by just over all exploring 24hours work are very hardly working from workers are any time busy from the service to packing, unpacking, loading, unloading, motor vehicles, car courier and office relocation this between are given up compulsory along option assistance by them avail to indeed to trustworthy again for the expert believe that hard to entire relocation here hassle for header to need all ways to wasting the growth if the ultimate company for this portal give us list of packers and movers in Noida all of service get process uppers to ultimate companies.

    http://www.fooglepackers.com/packersmoversnoida.html
    http://www.fooglepackers.com/packersmoverschennai.html
    http://www.fooglepackers.com/

    ReplyDelete
  18. cara menggugurkan kandungan dengan cepat dan akurat terbukti ampuh untuk melunturkan janin kehamilan muda 1 minggu hingga 1 , 2 , 3 dan 4 bulan
    obat penggugur kandungan adalah suatu bentuk proses berakhirnya kehamilan dengan dikeluarkannya janin ( fetus ) atau embrio sebelum memiliki kemampuan untuk berkembang dan bertahan hidup diluar rahim , sehingga bisa menyebabkan kematiannya pada janin
    Disini akan kami beritahukan kepada Anda langkah cara cepat menggugurkan kandungan dengan cepat dan selamat adalah KURET dan obat aborsi
    Kunyit memang tidak di baik di konsumsi oleh ibu hamil yang sedang hamil muda sehubungan dengan sifatnya untuk melancarkan haid , dan di percayai sebagai obat telat datang bulan
    jual obat aborsi paling manjur Misiprostol Cytotec asli terbukti ampuh melunturkan janin kuat tanpa kuret dengan bersih untuk usia 1 , 2 , 3 sampai 4 bulan dengan aman

    ReplyDelete
  19. Thanks for the detailed article on this topic. I would like to see more such awesome articles from you.

    ReplyDelete

Note:- Comment as: Option available to post without login select "Anonymous" from the drop down...........

For Latest Updates: Subscribe Now | | Test Your Knowledge, Take a Quiz now Click Here | | Site Best Viewed In Firefox

X