De Montfort University, IMAT5122: Linux System Change Logger Script
VerifiedAdded on 2022/11/13
|33
|1506
|167
Project
AI Summary
This document details the development of a Linux system change logger script for the IMAT5122 Computer Systems and Networks module. The project involves creating a bash script to monitor and log various system parameters, including current processes, CPU and RAM usage, USB devices, disk usage, home and other directories, and network interfaces. The script utilizes various Linux commands for data collection and presents the results in both a log file and web-based formats using PHP and HTML. The solution includes details on installing Linux in a dual-boot environment and within a virtual machine using Oracle VirtualBox. It also covers the design considerations for the bash script, the commands used, testing procedures, and the implementation of web log display using PHP and HTML. The project demonstrates a practical application of system monitoring and scripting skills within a Linux environment.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.

Computer Systems and Networks
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

Table of Contents
1. Introduction.......................................................................................................................................2
2. How to install the Linux in Dual Boot..............................................................................................2
3. Design consideration of bash script..................................................................................................4
4. Commands Used................................................................................................................................5
5. Testing................................................................................................................................................6
6. Web Log Display in PHP.................................................................................................................22
7. Web Log Display in HTML............................................................................................................26
8. Conclusion........................................................................................................................................31
9. References........................................................................................................................................32
1
1. Introduction.......................................................................................................................................2
2. How to install the Linux in Dual Boot..............................................................................................2
3. Design consideration of bash script..................................................................................................4
4. Commands Used................................................................................................................................5
5. Testing................................................................................................................................................6
6. Web Log Display in PHP.................................................................................................................22
7. Web Log Display in HTML............................................................................................................26
8. Conclusion........................................................................................................................................31
9. References........................................................................................................................................32
1

1. Introduction
A monitoring script that logs current processes , top 5 CPU and RAM utilizing processes, USB
devices plugged details, Details about the disk usage, details about the home directories, details
about other directories , connected network interfaces and their connection statuses and few more
details needs to be developed. The suitable commands needs to be studied and their usage should
be investigated. The results should be displayed in a specific log file as well as a specific web
file.
2. How to install the Linux in Dual Boot
In my windows desktop, Opened DISKMGMT.MSC. Disk management window opened. I
created two disk partitions. Both are logical volumes in extended partition. Both partitions are
unformatted.
Rebooted the system with Ubuntu desktop DVD in my DVD drive.
Booted with DVD
Linux installation started (Dalheimer and Welsh, 2009) (Negus, 2015).
Default options are selected.
Selected “Something Else” for the partition option
2
A monitoring script that logs current processes , top 5 CPU and RAM utilizing processes, USB
devices plugged details, Details about the disk usage, details about the home directories, details
about other directories , connected network interfaces and their connection statuses and few more
details needs to be developed. The suitable commands needs to be studied and their usage should
be investigated. The results should be displayed in a specific log file as well as a specific web
file.
2. How to install the Linux in Dual Boot
In my windows desktop, Opened DISKMGMT.MSC. Disk management window opened. I
created two disk partitions. Both are logical volumes in extended partition. Both partitions are
unformatted.
Rebooted the system with Ubuntu desktop DVD in my DVD drive.
Booted with DVD
Linux installation started (Dalheimer and Welsh, 2009) (Negus, 2015).
Default options are selected.
Selected “Something Else” for the partition option
2

Mapped one of the empty drive to / and set EXT4 file system and FORMAT=YES
Mapped another empty drive (I selected 1.5 times of my RAM size) to <SWAP> and format=no
Installed Linux
Rebooted the system
Found both systems are running fine.
While working with dual booted linux (Negus, 2015), faced lot of problems in taking screenshots.
So booted with windows.
Installed Oracle virtual box software (Virtualbox.org, 2019).
Created new vm
Installed Ubuntu 14 desktop OS (Releases.ubuntu.com, 2019) in the VM
Selected NAT option for the network.
Found the Linux VM is able to get the internet. Installed LAMP setup using the following
standard commands.
3
Mapped another empty drive (I selected 1.5 times of my RAM size) to <SWAP> and format=no
Installed Linux
Rebooted the system
Found both systems are running fine.
While working with dual booted linux (Negus, 2015), faced lot of problems in taking screenshots.
So booted with windows.
Installed Oracle virtual box software (Virtualbox.org, 2019).
Created new vm
Installed Ubuntu 14 desktop OS (Releases.ubuntu.com, 2019) in the VM
Selected NAT option for the network.
Found the Linux VM is able to get the internet. Installed LAMP setup using the following
standard commands.
3
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

3. Design consideration of bash script
The bash shell, which is mainly used in Linux OS is also known as bourne again shell (Newham,
2008). The main features of bash script are:
● Series of Commands are shown in plain text format.
● Easier to execute than command line.
● The extension for bash script file is ‘.sh’
● It is used to administer the OS and for remote access.
● The log files are used by the bash script to read commands.
Following are the steps used to create the bash script to find disk usage and processes. It will also
be used to identify users and networks:
1. To start with, ‘Nano’ or ‘vi’ are the text editors that are to be used for the creation of the
bash script file. To make file the file editor command is used along with script file.
2. Save the script file to process further commands (Tushar, 2013).
3. Write the bash script to identify users, disk usage and attached devices.
4. Run the bash script with ‘.sh’ extension command.
5. Test the created script.
6. Relocate the script to another location after the positive output result.
The Bash Script Uses:
The users are the input source for the shell script to provide output. Output is shown as per the
feedback from the users. The bash script is used to write its own commands. The shell script
helps in saving time as it is easier to process than the command line. The system administration
part is automated by default. The bash script consists of many types of shell scripts. Bourne
again shell is common for all Linux based OSs.
4
The bash shell, which is mainly used in Linux OS is also known as bourne again shell (Newham,
2008). The main features of bash script are:
● Series of Commands are shown in plain text format.
● Easier to execute than command line.
● The extension for bash script file is ‘.sh’
● It is used to administer the OS and for remote access.
● The log files are used by the bash script to read commands.
Following are the steps used to create the bash script to find disk usage and processes. It will also
be used to identify users and networks:
1. To start with, ‘Nano’ or ‘vi’ are the text editors that are to be used for the creation of the
bash script file. To make file the file editor command is used along with script file.
2. Save the script file to process further commands (Tushar, 2013).
3. Write the bash script to identify users, disk usage and attached devices.
4. Run the bash script with ‘.sh’ extension command.
5. Test the created script.
6. Relocate the script to another location after the positive output result.
The Bash Script Uses:
The users are the input source for the shell script to provide output. Output is shown as per the
feedback from the users. The bash script is used to write its own commands. The shell script
helps in saving time as it is easier to process than the command line. The system administration
part is automated by default. The bash script consists of many types of shell scripts. Bourne
again shell is common for all Linux based OSs.
4

Why use the script:
The shell script is usually the easiest for handling. It is easier to execute the file through the bash
script rather than using a terminal to process commands. The script contains a series of
commands ready for execution. Log files are used to display the output and for easy storage.
4. Commands Used
The following Linux commands are used (Team, 2019) (Jang, 2011)
Show the system current process top
Shows the list of files for the existing
directory.
ls –l
This command shows who is currently
accessing the system.
whoami
Used to create the script file. Vi , vim, Nano , pico , gedit
Script file extension .sh
Show the disk usage df –h
Show the disk usage for the home directories. du –h /home
Show the details of the Plugged devices lsusb
5
The shell script is usually the easiest for handling. It is easier to execute the file through the bash
script rather than using a terminal to process commands. The script contains a series of
commands ready for execution. Log files are used to display the output and for easy storage.
4. Commands Used
The following Linux commands are used (Team, 2019) (Jang, 2011)
Show the system current process top
Shows the list of files for the existing
directory.
ls –l
This command shows who is currently
accessing the system.
whoami
Used to create the script file. Vi , vim, Nano , pico , gedit
Script file extension .sh
Show the disk usage df –h
Show the disk usage for the home directories. du –h /home
Show the details of the Plugged devices lsusb
5

Connected Network interfaces and their
states
Ip link show
Details about the applications installed ls /usr/share/applications | awk -F
'.desktop' ' { print $1}' -
5. Testing
Initially installed Ubuntu 14 Desktop OS in dual boot mode. Running the commands and taking
screenshots are difficult while working with only Linux. Installed the same OS in a Oracle
Workstation with windows background.
Show the system current process top
6
states
Ip link show
Details about the applications installed ls /usr/share/applications | awk -F
'.desktop' ' { print $1}' -
5. Testing
Initially installed Ubuntu 14 Desktop OS in dual boot mode. Running the commands and taking
screenshots are difficult while working with only Linux. Installed the same OS in a Oracle
Workstation with windows background.
Show the system current process top
6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

7

Shows the list of files for the existing
directory.
ls –l
8
directory.
ls –l
8

This command shows who is currently
accessing the system.
whoami
used to create the script file. Vi , vim, Nano , pico , gedit
9
accessing the system.
whoami
used to create the script file. Vi , vim, Nano , pico , gedit
9
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

Show the disk usage df –h
10
10

Show the details of the Plugged devices lsusb
Connected Network interfaces and their
states
Ip link show
11
Connected Network interfaces and their
states
Ip link show
11

Details about the applications installed ls /usr/share/applications | awk -F
'.desktop' ' { print $1}' -
12
'.desktop' ' { print $1}' -
12
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

13

Changed the permissions of the file to fully executable
Ran the command ./mySysMonitor.sh
14
Ran the command ./mySysMonitor.sh
14

Viewed the output
15
15
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

16

17

18
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

19

20

21
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

6. Web Log Display in PHP
Viewing the log files in web format (Php.net, 2019)
Already installed APACHE in my Linux system (Group, 2019)
22
Viewing the log files in web format (Php.net, 2019)
Already installed APACHE in my Linux system (Group, 2019)
22

Already installed PHP in my linux system
23
23

Created a SYMBOLIC link (Jang, 2011)
ln –s /home/user/Desktop/mySysMonitor.log quicklogs
24
ln –s /home/user/Desktop/mySysMonitor.log quicklogs
24
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Created a getlogs.php in the Document Root , gave 777 permissions using chmod command and got the
WEB RESULTS
25
WEB RESULTS
25

7. Web Log Display in HTML
Wrote a new HTML code and Executed to get the results
26
Wrote a new HTML code and Executed to get the results
26

27
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.

28

29

30
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

8. Conclusion
A monitoring script that logs current processes , top 5 CPU and RAM utilizing processes, USB
devices plugged details, Details about the disk usage, details about the home directories, details
about other directories , connected network interfaces and their connection statuses and few more
details is developed. The suitable commands are studied. Their usage is investigated. The results
are displayed in a specific log file as well as a specific web file. Linux VM is installed in a
virtual box. LAMP setup is done in the Linux VM. Ubuntu 14 Desktop OS is used. Terminal is
used to run the BASH script. GEDIT is used as a editor. PHP is used to display the web results.
CHMOD is used to give the 777 permissions to the script file so that it can be executed by
anyone. Same 777 permissions are set to the log file so that it can be read by anyone and display
as a web output file.
31
A monitoring script that logs current processes , top 5 CPU and RAM utilizing processes, USB
devices plugged details, Details about the disk usage, details about the home directories, details
about other directories , connected network interfaces and their connection statuses and few more
details is developed. The suitable commands are studied. Their usage is investigated. The results
are displayed in a specific log file as well as a specific web file. Linux VM is installed in a
virtual box. LAMP setup is done in the Linux VM. Ubuntu 14 Desktop OS is used. Terminal is
used to run the BASH script. GEDIT is used as a editor. PHP is used to display the web results.
CHMOD is used to give the 777 permissions to the script file so that it can be executed by
anyone. Same 777 permissions are set to the log file so that it can be read by anyone and display
as a web output file.
31

9. References
Dalheimer, M. and Welsh, M. (2009). Running Linux. Sebastopol: O'Reilly Media,
Inc.
Group, D. (2019). Welcome! - The Apache HTTP Server Project. [online]
Httpd.apache.org. Available at: https://httpd.apache.org/ [Accessed 8 Sep. 2019].
Jang, M. (2011). RHCE Red Hat Certified Engineer Linux study guide. Berkeley,
Calif.: Osborne.
Negus, C. (2015). Linux bible. Indianapolis, IN: Wiley.
Newham, C. (2008). Learning the bash Shell. Sebastopol: O'Reilly Media, Inc.
Php.net. (2019). PHP: PHP Manual - Manual. [online] Available at:
https://www.php.net/manual/en/index.php [Accessed 8 Sep. 2019].
Releases.ubuntu.com. (2019). Ubuntu 14.04.6 LTS (Trusty Tahr). [online] Available
at: http://releases.ubuntu.com/14.04/ [Accessed 8 Sep. 2019].
Team, C. (2019). The Linux command line for beginners | Ubuntu tutorials. [online]
Tutorials.ubuntu.com. Available at: https://tutorials.ubuntu.com/tutorial/command-
line-for-beginners#0 [Accessed 8 Sep. 2019].
Tushar, S. (2013). Linux Shell Scripting Cookbook. Birmingham: Packt Publishing.
Virtualbox.org. (2019). Oracle VM VirtualBox. [online] Available at:
https://www.virtualbox.org/ [Accessed 8 Sep. 2019].
32
Dalheimer, M. and Welsh, M. (2009). Running Linux. Sebastopol: O'Reilly Media,
Inc.
Group, D. (2019). Welcome! - The Apache HTTP Server Project. [online]
Httpd.apache.org. Available at: https://httpd.apache.org/ [Accessed 8 Sep. 2019].
Jang, M. (2011). RHCE Red Hat Certified Engineer Linux study guide. Berkeley,
Calif.: Osborne.
Negus, C. (2015). Linux bible. Indianapolis, IN: Wiley.
Newham, C. (2008). Learning the bash Shell. Sebastopol: O'Reilly Media, Inc.
Php.net. (2019). PHP: PHP Manual - Manual. [online] Available at:
https://www.php.net/manual/en/index.php [Accessed 8 Sep. 2019].
Releases.ubuntu.com. (2019). Ubuntu 14.04.6 LTS (Trusty Tahr). [online] Available
at: http://releases.ubuntu.com/14.04/ [Accessed 8 Sep. 2019].
Team, C. (2019). The Linux command line for beginners | Ubuntu tutorials. [online]
Tutorials.ubuntu.com. Available at: https://tutorials.ubuntu.com/tutorial/command-
line-for-beginners#0 [Accessed 8 Sep. 2019].
Tushar, S. (2013). Linux Shell Scripting Cookbook. Birmingham: Packt Publishing.
Virtualbox.org. (2019). Oracle VM VirtualBox. [online] Available at:
https://www.virtualbox.org/ [Accessed 8 Sep. 2019].
32
1 out of 33
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.