cron script needed to restart vsftpd if it is not running

Hi,
Anybody have a script to check that vsftpd is running and start it if it is not?  I need to put such a script in cron to make sure my ftp service is always up (will check every 10 minutes).

Thanks
jdanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SuperdaveCommented:
ps -a|grep -q vsftpd|vsftpd &

possibly you'll need to include the path of vsftpd and maybe the others if it's run from cron
0
SuperdaveCommented:
I meant this, sorry:

ps -a|grep -q vsftpd||vsftpd &
0
ajay_mhasalCommented:
Hi,

Create a file ftpstatus.sh and add following

----------------------------
#!/bin/bash
if [ -f /var/lock/subsys/vsftpd ]; then
 echo "vsftpd is running "
else
 service vsftpd restart
fi
------------------------------

# chmod 775 ftpstatus.sh

Now set it in root's cron

# crontab -e

And add this line

*/10 * * * * <path to ftpstatus.sh>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jdanAuthor Commented:
Thanks, that is just what i was looking for.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.