Reference no: EM131984987
Assignment: Linux, virtualbox and centOS7
Write a script in BASH that automatically writes your system's private (eth0) and public IP addresses to a file within your home directory called ipaddresses. The automatically generated ipaddresses file should contain the following information:
The date command must be used to provide a timestamp at the top of the file in the following format: Timestamp: (HH:MM) MMDDYYYY.
The next line should contain: ETH0 IP: XXX.XXX.XXX.XXX.
The last line should contain: Public IP: XXX.XXX.XXX.XXX.
The script should overwrite any current entries with the new entries, not append them to the file. Don't forget to change the permissions on the script so that it is executable! Setup a cron job to run the script every 30 mins, you can verify this works by checking the timestamp in the ipaddresses file to see if it is being updated correctly, make sure you let your VM run for a few hours during testing. Be sure to include a copy of your .bashrc file, a copy of your ipaddresses script and output file, and your cron job line in your lab report along with a description of how you set it up and what it means.
I cannot find eth0 when searching for IP, I need to use esp0s8. I tried the following without success, all I get are errors when executed. Any help would be appreciated.
#!/bin/bash
date=$(date +\"%m%d%Y\")
ip=$( ifconfig eth0 | sed -n '2p' | awk '{print $2}' | awk -F : '{print $2}' )
pubip=$(wget -qO- ipinfo.io/ip)
printf $date"\n"$ip"\n"$pubip"\n"i > ~/ip.info ;
#end
Save file in home directory by name "filename.sh" and change permission using following command:
"sudo chmod +x filename.sh"
The edit crontab using command : "crontab -e".
Content of crontab is as follows:
30 * * * * ~/filename.sh
Why do some people choose linux over windows
: Why do some people choose Linux over Windows? Use 2 or 3 sentences to answer this two question, dont copy the answer for web!!!! just input them.
|
Are such trade publications credible
: Are such trade publications credible? Are they scholarly? Would you or would you not cite from them if preparing a professional report or publication
|
List and describe the six addressing modes of the processor
: List and briefly describe the 6 addressing modes of the x86 processor. Description should include how an operand is formed and where it operates on memory.
|
Are such trade publications credible
: Are such trade publications credible? Are they scholarly? Would you or would you not cite from them if preparing a professional
|
Writes your systems private and public ip addresses
: Write a script in BASH that automatically writes your system's private (eth0) and public IP addresses to a file within your home directory called ipaddresses.
|
Write a command that will tell me the unique files
: For example, "favicon.ico" is one. Write a command that will tell me the unique files that have been accessed. All of GET, HEAD, and POST count.
|
Why solid-state drives are preferred over hard drives
: Why solid-state drives are preferred over hard drives, particularly in laptop computers. For full credit, you must give sufficient supporting technical detail.
|
What is the total asset turnover and the capital intensity
: Silas 4-Wheeler, Inc., has an ROE of 18.06 percent, equity multiplier of 1.40, and a profit margin of 15.00 percent.
|
Find all the files and directories in the demo directory
: Find all the files and directories in the demo directory that are newer than s1. Send the output of the command to /var/tmp/t1 (dont send it to demo directory).
|