Purpose of the script:
Requirement: you want to monitor the utilization of a directory every hour. create the below script and schedule it to run for every hour.
First create a script file using Vi editor. and write the code like mentioned below
eg. vi test
#!/bin/bash
SID=$SAPSYSTEMNAME
echo "this will generate file for /usr/sap utilization for $SID" >> size.txt
df -h /usr/sap >> size.txt
date >> size.txt
Requirement: you want to monitor the utilization of a directory every hour. create the below script and schedule it to run for every hour.
First create a script file using Vi editor. and write the code like mentioned below
eg. vi test
#!/bin/bash
SID=$SAPSYSTEMNAME
echo "this will generate file for /usr/sap utilization for $SID" >> size.txt
df -h /usr/sap >> size.txt
date >> size.txt
This script will add the utilization of directory /usr/sap along with date in the txt file 'size.txt'
Output:
This will generate file for /usr/sap utilization for PRD
Filesystem Size Used Available Capacity Mounted on
eu-prdci-test_bk/usr_sap 500M 306M 194M 62% /usr/sap
Thu Jul 25 10:36:04 UTC 2019
this will generate file for /usr/sap utilization for PRD
Filesystem Size Used Available Capacity Mounted on
eu-prdci-test_bk/usr_sap 500M 306M 194M 62% /usr/sap
Thu Jul 25 10:42:43 UTC 2019
No comments:
Post a Comment