• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 564
  • Last Modified:

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
0
jdan
Asked:
jdan
  • 2
1 Solution
 
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
 
jdanAuthor Commented:
Thanks, that is just what i was looking for.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now