Ruby script for checking the apache process
#!/usr/bin/ruby -w
require 'etc'
s= `netstat -ntlp|grep apache2`
if s==""
`/etc/init.d/apache2 start`
Tan=File.open('/home/gen/logs/info','a')
Tan.puts "Apache server started at " + Time.now.to_s + " with " + ` /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`+ "with user login as "+ Etc.getlogin
Tan.close
end
This script i will be working fine for unix users.
CronJob script for every 1 minutes
# m h dom mon dow command
*1/ * * * * ruby /home/gen/JSwing/ruby/cron.rb
No comments :
Post a Comment