Edit a script named update.sh that generates status.html in your web directory: ~/public_html/.
I need to write specific commands to show each specific item
The generated webpage should include information related to:
UNIX : kernel version of ed-lab server
USER : number of users on the server and who they are
PROCESS : what is the first (oldest) root's process, and when it started
NETWORK : IP address of eth0 interface and its MAC address
ROUTE : what is the default route of ed-lab server
LAN : how many other machines are there in ed-lab server's local area network (LAN)? what are their IP/MAC mappings?
CONNECTION : how many TCP connections
UPDATE : when is the system information last updated
Relevant:
uname, who, route, ifconfig, hostname, and more
I've already completed the kernel version and the number of users, but I am having a lot of difficulty figuring out what switches to use with the certain commands.
UMass Amherst, Amherst, MA, United States, Robert Walls and Yung Chih Chen, CS197U
The problems as of right now that I am having difficulty with are:
finding the first process and the date it started( i know it has to do with init but i can't find out how to find a command that only prints the name of the process and another command that prints out the date)
Using a command that shows only the MAC address as the output
Using a command that shows the default route of the server I am on
Using a command that finds the number of LAN connections on the server
And a command showing the IP/MAC mappings of each of the LAN connected computers
I don't know that there are single commands ("a command") to do exactly what you need.
So it might be that you need to find the command that gets generally what you're looking for, and then use other commands, like awk, sed, cut and grep, etc. to extract the exact information you need.
Which version of what Linux are you using, and what shell?
Additionally, I am sure you must have used the ps command? With the right options, that can also show the date when a process starteed. Here's a link to the man page: ps(1).
There's PERL, which is a "practical extraction and reporting language". It can be a bit overwhelming for newbies, so if you need to "extract" anything from ps or any of the network commands, I would suggest using awk!
1 : Finding the first process: once youve mastered a bit ps command it should not be too difficult to find the requested... it must be PID 0 or 1 or...
You are to look at the man pages for ps syntax differ between OS (e.g ps ax v.s. ps -ef...)
Here is a tip: you can find a man page by entering
man <command>
but this assumes that you know which command you look for. You can also search the man database for keywords by using the "-k" switch.
man -k foo
will display a list of all articles involving "foo". You can then start to read these articles one by one. Also useful: at the end of each man page there is usually a paragraph labeled "SEE ALSO". I suggest you do exactly this.
For instance:
You sure know the network protocol which maps layer-2 (MAC) addresses to layer-3 (IP) addresses, don't you? Now, enter this as a keyword in a "man" search and you might find some useful references.