Changes

Jump to: navigation, search

OPS435 Test1 Practice - Bash

658 bytes added, 21:49, 22 February 2016
no edit summary
You need to be able to write a short script using constructs and utilities we've discussed in the course so far. These exercises should be helpful to you as practice to reinforce what you already learned during the semester.
 
= Variables =
 
== Email Apache status ==
 
Write a script that will email the number of apache processes currently running to admin@yourdomain.com. The syntax of the '''mail''' command is:
 
<source lang="bash">mail admin@yourdomain.com -s "Your subject" "body of message"</source>
 
One line of the output of the '''ps''' command looks like this:
 
<source lang="bash"> 1030 ? Ssl 0:00 /usr/bin/apache</source>
 
You can get the current date with the '''date''' command.
 
Your script should count the number of apache processes running, and send the admin an email with a body like this: "There are now (2016-02-22 14:21) 3 apache processes running".
= Conditions =

Navigation menu