Thursday, March 9, 2017

Linux Server Service Start if it's automatically stopped.


Create File Name like servicestart and enter below lines in to that and replace the service=apache2 to anyother service name.

# vi servicestart
+++++++++++++++++++++
#!/bin/bash
service=apache2

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start
fi
+++++++++++++++++++++
Save an Close this file.

Put it in to Cron to run at every minute.

# crontab -e
*/1 * * * * /bin/bash /root/servicerestart

2 comments:

  1. JackpotCity Casino: 50 FREE SPINS for all New Players
    JackpotCity Casino 전주 출장안마 is the most exciting, 인천광역 출장샵 original and innovative casino you 용인 출장마사지 can play at. Claim your 100% welcome bonus and access over 5000 other 경산 출장안마 Casino 목포 출장마사지

    ReplyDelete
  2. NBA Predictions 1xbet korean – our greatest NBA bets at present are well-known, that includes sport predictions and player projections. Dimers.com gives sports activities followers the tools, evaluation and knowledge to excel at sports activities betting. The board of the Oregon Lottery Commission made the state of Oregon the twelfth state in the United States to make sports activities betting legal in August 2019. If the parlay wins, the payout is bigger than individual single bets. Calculating the payout your self is more difficult than Sports Betting 101. Future bets are wagers positioned on a contest that may happen at a distant later date.

    ReplyDelete