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.


29 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 was suggested this blog by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my difficulty. You are wonderful! Thanks!
    estateguru |

    ReplyDelete
  3. You may post on the professional credentials for the blog owner. You could express it's outstanding. Your blog experience can springboard your click through.
    dollhousesd.com |

    ReplyDelete
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. Great article Lot's of information to Read...Great Man Keep Posting and update to People..Thanks 
    pandoraschmuckshop |

    ReplyDelete
  10. 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
  11. Oh that poster, yes I know it from the Gold edition of Gothic 2, good choice!
    http://www.liveithealthyforlife.com |

    ReplyDelete
  12. 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
  13. 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
  14. Shipped very quickly, items as described, very pleasant experience! Thanks!
    www.autotransportandmore.com |

    ReplyDelete
  15. 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
  16. Fantastic work and very well-written article. I will recommend reading it to all my friends
    www.autoscoloris.com |

    ReplyDelete
  17. 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
  18. 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
  19. With continuous ray bans china
    innovation and breakthrough of the attitude, the world's top Oakley sunglasses outlet
    sports brand launched 2017 new series Oakley Oakley sunglasses glasses, classic style and fashion elements combined with excellent technology, advanced technology, exquisite materials and unique details, again to create extraordinary sunglasses ray ban sale
    quality glasses series, design and style features perfect the interpretation of the comfort, trend and function of creative fusion.
    With the accelerated pace of life, often in the way of urban metrosexual oakley sunglasses wholesale
    man on different occasions, the demand for natural glasses become more diversified. Oakley Oakley's designers are keen to capture the changes in consumer demand, with the introduction of new Crossrange type series, respectively, daily modeling and motion occasions design, meet the usual wear and sports demand, help for all occasions with active metrosexual oakley cheap
    man stylish dress and extraordinary performance.
    Oakley Oakley has enjoyed the world's top players favor, this time the upgraded EVZERO STRIDE Light Sport frame zero all-weather super nature will not live up to expectations. As a final can be used for various sports sunglasses, zero - all-weather large frameless design to minimize the glasses bearing, perfectly fit the nose and face, no matter what challenge, can help the wearer to pursue the best performance, bring a dazzling aura for every fashion movement.
    Take the light route HOLBROOK METAL Pioneer - ultra-thin metal is another style, it's rectangular lens and stainless steel frame will be the perfect combination of life aesthetics and performance characteristics. What is more, the sunglasses was a detail hundred-percent control, taking high purity materials provide 100% UV protection at the same time, the perfect show color change is sensitive to the wearer, bring incomparable vision to enjoy.
    As for the pursuit of a positive life style of people, Fin Box - is a rectangular rogue you don't want to miss. The design of the classic rectangular lens sunglass ray ban cheap
    is full of masculinity, not only the material lightweight fashion, but also with four sets of different sizes of the nose, greatly improving the comfort of wearing.

    ReplyDelete
  20. Great post,Thanks for providing us this great knowledge,Keep it up.
    run2online.net

    ReplyDelete
  21. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. Nice! thank you so much! Thank you for sharing.
    http://www.baixar-whatsapp-gratis.com.br

    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