The report is prepared for the creation of two Scheel script designed to run in different environment for returning the operating system routine function. For the development of the report some examples are evaluated and a research is done on the administrative function that can be used for identification of the system resource usage and management of the system components. For the development of the windows script Windows 10 operating system is used and for the development of the bash shell script Knoppix 8.1 is used. The Unix system is booted using VMWare and the scripts are attached with the report along with the screenshot of the out for the demonstration of functionality of the script.
Copies of the scripts
Windows
:: The batch file is created for testing the system configuration
:: The output is stored in result.txt file.
ECHO OFF
:: Display current processes
echo The following processes are running in the current system >> result.txt
tasklist >> result.txt
:: Display current users logged in
echo The following user is currently logged in:>> result.txt
echo %username% >> result.txt
::Display device plugged in
echo The following device is currently plugged in with the system >> result.txt
wmic logicaldisk where “drivetype =2” get VolumeName >> result.txt
echo.
:: Display overall disk usage
echo The details of the disk space is given below: >> result.txt
wmic logicaldisk get size,freespace,caption >> result.txt
echo The other details of the system: >> result.txt
systeminfo >> result.txt
:: Clear temporary files
echo The following temporary files has been deleted >> result.txt
del /q/f/s %TEMP%* >> result.txt
Unix
#! /bin/bash
#Author :
#Declaring variables
#set -x
#1) Displaying the Current Processes:
echo “Current Processes are listed below
$(ps -aux | sort -rk 3,3 | head -n 6)” >>system.log
process_id=`ps -ef | awk {‘print$2′} | cut -f2 -d’-‘`
Process_Time=`ps -ef | awk {‘print$5′} | cut -f2 -d’-‘`
Current_processes=`ps -ef | awk {‘print$8′} | cut -f2 -d’-‘`
#2) Displaying the currently logged in users:
echo ” The current users Logged in th system
$(who)” >>system.log
username=`who | awk {‘print$1′} | cut -f1 -d’,’`
date=`who | awk {‘print$3′} | cut -f1 -d’,’`
Time=`who | awk {‘print$4′} | cut -f1 -d’,’`
#3) Devices Plugged in
echo ” Currently Devices Plugged in
$(ls -l)” >>system.log
Permission_plugged_in_device=`ls -l /dev/ | awk {‘print$1’}`
#4) Overall Disk Usage
echo “Overall Disk Usage
$(du -sh)” >>system.log
Disk_Usage_for_Other_Directory=`du -sh | tail -l | awk {‘print$1’}`
Plugged_in_Device=`ls -l /dev/ | awk {‘print$6’}`
home_directory_disk_usage=`du -sh /home/ | tail -l | awk {‘print$1’}`
Other_Directory=`du -sh /home/student/Downloads | tail -l | awk {‘print$1’}`
#5)Network Interfaces states
echo “network interface states
$(ip -s link)” >>system.log
network_interface_status=`ip -s link`
#6)RAM Usage
echo “RAM Consumption
$(free -hm)” >>system.log
Used=`free -hm | head -2 | tail -1 | awk {‘print$3’}`
Total_Ram=`free -hm | head -2 | tail -1 | awk {‘print$2’}`
#7)Current Operating System Version
echo “Operating System Version
$(uname -r)” >>system.log
OS_Information=`uname -r `
#Creating directory for storing report files
if [ ! -d ${HOME}/System_Monitor ]
then
mkdir ${HOME}/System_Monitor
fi
Discussion
For the development of the shell script in windows the script is written in notepad and it is saved in .bat extension for executing it as a batch file. The shell script is created based on the terminal of the system and thus there is a change in the syntax of the codes found in different examples to run in the Knoppix operating system. The batch script is used in the windows environment and here the multiples process are divided into section also known as batch and it does not need the intervention of the user. The batch script is used for performing cross platform batch processing in the distributed network environment. The batch files are executed in background and its output can be generated in a text file. For executing the shell script file the file is needed to be given the root permission and for this the following command is used.
chmod +x Sysmonitor.sh. The output of the shell script command is stored in the system.log file that would help to identify the current status of the system. The batch script is created for deleting the temporary files and listing the details of the system that would help to identification of the error and troubleshooting it easily. The batch script created in the assignment helps in identification of the process currently running on the system, disk space, details of the logged in user, network interface and deleting the temporary files such that the user For both the shell script and the batch script the output is stored in separate file.
For the shell script the output is stored in system.log file and for the batch file the output is stored in result.txt file. There are different examples of scripts that are evaluated for the development of the original script and the source of the scripts are added as reference in the report. The original script is develop after evaluation of the system information are needed to be displayed to the user for proper management of the system resource and that can help in troubleshooting the errors in the system.
For increasing the utility of the script the command for deleting the temporary files are added and in the shell script the old files that are greater than 30 months are deleted by running the script. For running the shell script ./Sysmonitor.sh command is used and its output is stored in the log file. The batch script is written in notepad and saved as .bat extension and for running it the batch file is double clicked and the output gets stored in the result file.
Conclusion
From the above report it can be concluded that for creating the script file on Unix and windows a research is made on the different command used for getting output from the system. Different examples of shell script created by other author are analysed and the system administration function that can be generated with the script are also evaluated for the development of the script. For the installation of the Unix operating system the VMware workstation is installed in the PC on which the Knoppix operating system is installed for the generation of the bash shell script. The scripts are tested for any error and resolved for the its proper working and provide useful system administrative function.
Cannon, J. (2015). Shell Scripting: How to Automate Command Line Tasks Using Bash Scripting and Shell Programming.
How to Use Windows Batch File Commands to Automate Repetitive Tasks. (2016). MakeUseOf. Retrieved 8 December 2018, from https://www.makeuseof.com/tag/use-windows-batch-file-commands-automate-repetitive-tasks/
Johnson, S. (2018). The Complete LINUX Operating system for Absolute Beginners Guide: Also Learn UNIX Administration, Shell Scripting, Virtual Terminal and its application.
Windows Commands. (2018). Docs.microsoft.com. Retrieved 8 December 2018, from https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download