This script checks if a cron is present on server, if not add cron entry.
Then checks if there is any old hung process, if yes and its hung for more than 5 mins kill all such process and restart cron.
Also checks for hung process from another way ie by checking modified time of log file created from cron if mtime is more than a value, restart cron.
Log every task performed like : cron added, restarted, processes killed in a log file.
Flag File is used to track events.
And finally sends a mail for failure / success.
Below is how you can replicate the environment :
Make a dummy cron file and cron script by yourself. ( keep editing cron script for testing, add sleep or just print hello , etc )
Change mtime of log file manually.
For sending mail, use system mail accounts ( root@server )
You must have read everything during your learning session, its all basics and was part of your learning plan, still if you don’t understand anything, you can simply google it or go through your training material again.
Point to remember :
No user input or break point.
Use error handling at every point.
Make everything verbose, Add comments for every function
Use proper indentation
Check it thoroughly before handing it over.
I am currently working as a software tester with vast Unix shell scripting knowledge. So I think I will be the best resource to be choosen for this project
Hey, there! I am system administrator and works on all the Operating systems, CentOS and Ubuntu where my expertise is there. Automation is my day to day work. I use Perl and python for auto ating stuffs. please consider for this job. I'm in a need of money so this will help me in that way too. Thanks in advance.