Question: Linux class questions: Answer these questions using any one of your virtual machines. Be sure to specify which virtual machine you are using at the

Linux class questions:

Answer these questions using any one of your virtual machines. Be sure to specify which virtual machine you are using at the top of your responses since the responses to a few of the questions will vary by system.

1. You have a daemon called foo that one of your users wrote. It periodically stops responding but doesn't die. The client application (/usr/local/bin/bar) will exit with a return code of '1' if it can't connect, and will exit with a '0' if it can. (You don't have to worry about the client hanging around.) Write a shell script which will check to see if the daemon is responding and if not, restart it. Be sure not to kill it if it is working.

2. Create a crontab entry that will use your script from the previous question to check the application once every 5 minutes.

3. You have another application that has gone nuts. There are 200 instances of 'foobar' in the process table and it's accelerating. You want to kill every instance. Write a command line to do this. (This doesn't require cron.)

4. You have an application that writes temporary files to a particular directory, /var/foo. These files are necessary, but they build up over time and the application doesn't clean up after itself. Any file older than one hour can safely be eliminated. Write a script and a cronjob that once an hour deletes any files in this directory that is more than one hour old. You may need to read the find man page carefully. This may not be possible in traditional UNIX find, you will need to use GNU find. Most Linux systems have GNU find installed, and the OpenIndiana flavor of Solaris does as well.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!