OS
1) File Permission Checking
#!/bin/bash
if [ $# -ne 2 ]
then
echo "Insufficient Arguments"
exit
fi
p1=`ls -l $1 | cut -c 1-10`
p2=`ls -l $2 | cut -c 1-10`
if [ "$p1" = "$p2" ]
then
echo "Permissions are same"
echo "Permission of both files are $p1"
else
echo "Permissions are different"
echo "Permission of first file is $p1"
echo "Permission of second file is $p2"
fi
------------------------------------------
Commands to Run (Folder : skilltest2)
------------------------------------------
mkdir skilltest2
cd skilltest2
cat f1
cat f2
gedit .......................................
save file as files.sh
sh files.sh f1 f2
========================================
#!/bin/bash
echo "Memory Consumption Output"
free -h > /home/cse/skilltest2/memoryoutput.txt
echo "Checking Remote Server Connectivity"
ping -c 4 8.8.8.8 > /home/cse/skilltest2/pingoutput.txt
------------------------------------------
Commands to Run
------------------------------------------
gedit ..........
crontab.sh save
crontab -e
* * * * * sh /home/cse/skilltest2/automation.sh
Save:
Ctrl + O
Enter
Ctrl + X
cat memoryoutput.txt
cat pingoutput.txt
Comments
Post a Comment