|
This script is very useful for system admins, it checks Cpuload and get info of which process takes the cpuload, if cpuload is or above 70% it sends alert email to admin
==============================
#!/bin/bash
# Shell script to monitor or watch the high cpu-load
# It will send an email to $ADMIN, if the (cpu load is in %) percentage
# of cpu-load is >= 70%
# If you have any suggestion or question please email to ravi<at>indiangnu <dot> org
# set admin email so that you can get email
# set alert level 70% is default
# you can set it to string LOAD with your value
AWK=/bin/awk
SAR=/usr/bin/sar
GREP=/bin/grep
TR=/usr/bin/tr
HEAD=/usr/bin/head
PS=/bin/ps
SORT=/bin/sort
HOSTNAME=indiangnu.org
SED=/bin/sed
LOAD=70
CAT=/bin/cat
MAILFILE=/tmp/mailviews$$
MAILER=/bin/mail
mailto=”ravi@indiangnu.org”
for path in $PATHS
do
CPU_LOAD=`$SAR -P ALL 1 2 | $GREP ‘Average.*all’ | $AWK -F” ” ‘{ print 100.0 -$NF}’`
echo $CPU_LOAD
if [[ $CPU_LOAD > $LOAD ]];
then
PROC=`$PS -eo pcpu,pid -o comm= | $SORT -k1 -n -r | $HEAD -1`
echo “Please check your processess on ${HOSTNAME} the value of cpu load is $CPU_LOAD % & $PROC” > $MAILFILE
$CAT $MAILFILE | $MAILER -s “CPU Load is $CPU_LOAD % on ${HOSTNAME}” $mailto
fi
done
=============================
After end of schedule cron job for this script like below
*/30 * * * * /bin/sh /root/cpuload.sh >/dev/null 2>&1
Thanks
Ravi
Introduction - Array is one of the best feature of Bash shell and I am fan of this feature!!. Bash shell provides one-dimensional array. Any variable may be used as an array. There are many ways to declare array. Builtin “declare” command is used to explicitly declare an array. There is no maximum limit on the size of an array, nor any requirement that members be indexed or assigned contiguously. Arrays are indexed using integers and are zero-based. A array is created automatically if any variable is assigned to using the syntax array_name[subscript]=value. The subscript is treated as an arithmetic expression that must evaluate to a number greater than or equal to zero. To explicitly declare an array, use “declare -a name“. “declare -a name[index]” is also accepted and the “index” is ignored here.
Arrays are assigned to using compound assignments of the form array_name=(value1,value2, … valueN), where each value is of the form [index]=string. Only string is required. In bash array indexing is same as C language which starts at zero. This syntax is also accepted by the declare builtin.
* How to assign/declare array variable in Bash shell -
declare -a myarr[0]=”Arun”
declare -a my_array
my_array=(Arun Bagul Bangalore Mumbai Raju Santhosh Ravi)
apna_array=([0]=arun [1]=bagul [4]=Santhosh [3]=ravi [5]=1024)
array[1]=”Bagul”
* How to refer the array and it’s element -
Suppose I want to print the above array “apna_array”, the syntax as shown below….
echo “${apna_array[*]}”
and
echo “${apna_array[@]}”
This syntax is very common in bash shell, ${variable_name} is same as $variable_name. While in array the “[*]” and “[@]” indicate the all element of array.
NOTE - Remember above two syntax are not same there is one difference. It’s an assignment for you guys/girls!
* How to access particular element of array -
name=(Arun Bagul Bangalore Mumbai Raju Santhosh Ravi)
here “name” is an array and I want to access the first and second element of the array “name”.
echo “My name is - ${name[0]} ${name[1]}”
* How to find the length of array or element of array -
${#my_array[index]} expands to the length of (element of array) ${my_array[index]} . If “index” is “*” or “#” then expansion is the number of elements in the array. Please note - referencing an array variable without a subscript/index is equivalent to referencing element zero.
Suppose “student” is array then, ${student} is same as ${student[0]}
#declare and assign elements to array “student_record” -
student_record=(10 “Ravi Bhure” “1st year of BE” “SSVPS College” Dhule)
echo ${student_record}
echo ${student_record[0]}
echo “Total no of element in array is - ${#student_record[*]}”
echo “Total no of element in array is - ${#student_record[@]}”
echo “Length of element is - ${#student_record[1]}”
* How to delete element of array -
“unset“ builtin command is used to delete element of array.
unset array_name[index] - delete the array element at given “index”. If “index” is “*” or “@” then, it will removes the entire array.
big_city=(Bangalore Pune Nasik Hydrabad Surat)
Here “big_city” is the array of big cities in India. Suppose I want to delete “Nasik” from above array -
unset big_city[2]
* Example - Look below script and it’s output
root@arun:~# cat how_to_array.sh
#!/bin/bash
#declare and assign element
declare -a myarr[0]=”Arun”
declare -a metro_array=(Mumbai Delhi Kolkata Chennai)
declare -a my_array
my_array=(Arun Bagul Bangalore Mumbai Raju Santhosh Ravi)
name_arr[1]=”Arun Bagul”
echo “————————–”
echo “myarr is - ${myarr[0]}”
echo “Metro cities in India - ${metro_array[*]}”
echo “My name is - ${my_array[0]} ${my_array[1]}”
echo “Name - ${name_arr[1]}”
echo “Name - ${name_arr[*]}”
echo “————————–”
#how to assign element in array
myarr[1]=”- System Engineer!”
echo “myarr is - ${myarr[*]}”
apna_array=([0]=arun [1]=bagul [3]=Santhosh [4]=ravi [5]=1024)
echo “${apna_array[*]}”
echo “${apna_array[@]}”
student_record=(10 “Ravi Bhure” “1st year of BE” “SSVPS College” Dhule)
echo ${student_record}
echo ${student_record[0]}
echo “Total no of element in array is - ${#student_record[*]}”
echo “Total no of element in array is - ${#student_record[@]}”
echo “Length of element is - ${#student_record[1]}”
#how to delete array -
del_arr=(Arun Bagul)
echo “del_arr before ‘delete’ is - ${del_arr[*]}”
#delete
unset del_arr
echo “del_arr after ‘delete’ is - ${del_arr[*]}”
echo “————————–”
#how to delete one element in array -
big_city=(Bangalore Pune Nasik Hydrabad Surat)
#suppose - want to delete “Nasik” from above array -
echo “Big City before ‘delete’ is - ${big_city[*]}”
#delete
unset big_city[2]
echo “Big city after ‘delete’ is - ${big_city[*]}”
root@arun:~#
*** Run above script -
root@arun:~# ./how_to_array.sh
————————–
myarr is - Arun
Metro cities in India - Mumbai Delhi Kolkata Chennai
My name is - Arun Bagul
Name - Arun Bagul
Name - Arun Bagul
————————–
myarr is - Arun - System Engineer!
arun bagul Santhosh ravi 1024
arun bagul Santhosh ravi 1024
10
10
Total no of element in array is - 5
Total no of element in array is - 5
Length of element is - 10
del_arr before ‘delete’ is - Arun Bagul
del_arr after ‘delete’ is -
————————–
Big City before ‘delete’ is - Bangalore Pune Nasik Hydrabad Surat
Big city after ‘delete’ is - Bangalore Pune Hydrabad Surat
root@arun:~#
Thank you,
Arun Bagul
Few months ago I wrote a script that mail to admin for low disk space Shell script to monitor or watch the disk space but now here we improved the script in few better steps.
#!/bin/bash
# Shell script to monitor or watch the low-disk space
# It will send an email to $ADMIN, if the (free avilable) percentage
# of space is >= 90%
# ————————————————————————-
# Linux shell script to watch disk space (should work on other UNIX oses )
# SEE URL: http://www.indiangnu.org
# set admin email so that you can get email
# set alert level 90% is default
PATHS=”/”
AWK=/bin/awk
DU=”/usr/bin/du -ks”
GREP=/bin/grep
DF=”/bin/df -k”
TR=/usr/bin/tr
SED=/bin/sed
CAT=/bin/cat
MAILFILE=/tmp/mailviews$$
MAILER=/bin/mail
mailto=”ravi@indianGNU.org”
for path in $PATHS
do
DISK_AVAIL=`$DF $path | $GREP -v “Filesystem” | $AWK ‘{print $5}’|$SED ’s/%//g’`
if [ $DISK_AVAIL -gt 90 ];then
echo “Please clean up your stuff \n\n” > $MAILFILE
$CAT $MAILFILE | $MAILER -s “Clean up stuff” $mailto
fi
done
Thanks
Introduction-
The UNIX/Linux Administrator or programmers have difficulties to solve this kind of quiries. Many times we need to rename perticular files within the given directories for example
we have to rename all the text file to conf file ie *.txt file to *.conf file….
We can use Pattern matching with String Operators in Shell scripting –
root@arunbagul:/home/arun/templates# touch main.txt data.txt readme.txt sample.txt demo.txt
root@arunbagul:/home/arun/templates# ls
data.txt demo.txt main.txt readme.txt sample.txt
root@arunbagul:/home/arun/templates#
Suppose you have thousands of *.txt files in given directory -
It is very difficult to rename this files to some other extension like *.conf
Take the above case and we will try to rename *.txt file by using shell script
root@arunbagul:/home/arun# ls -l /home/arun/templates/
total 0
-rw-r–r– 1 root root 0 2008-03-13 16:29 apache.conf
-rw-r–r– 1 root root 0 2008-03-14 02:50 data.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 demo.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 main.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 readme.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 sample.txt
root@arunbagul:/home/arun#
** In above “/home/arun/templates/” directory there are few *.txt files and
we will rename this files as *.conf files. There is apache.conf file, which will not rename.
root@arunbagul:/home/arun# ll /home/arun/templates/
total 0
-rw-r–r– 1 root root 0 2008-03-13 16:29 apache.conf
-rw-r–r– 1 root root 0 2008-03-14 02:50 data.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 demo.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 main.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 readme.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 sample.txt
root@arunbagul:/home/arun#
Now run our command as given below..
root@arunbagul:/home/arun# ./rename.sh /home/arun/templates txt conf
Rename all the *.txt files as .conf files…
Directory is = /home/arun/templates
renaminng /home/arun/templates/main.txt to /home/arun/templates/main.conf
renaminng /home/arun/templates/apache.txt to /home/arun/templates/apache.conf
renaminng /home/arun/templates/sample.txt to /home/arun/templates/sample.conf
renaminng /home/arun/templates/demo.txt to /home/arun/templates/demo.conf
renaminng /home/arun/templates/data.txt to /home/arun/templates/data.conf
renaminng /home/arun/templates/readme.txt to /home/arun/templates/readme.conf
root@arunbagul:/home/arun#
root@arunbagul:/home/arun# ls -l /home/arun/templates/
total 0
-rw-r–r– 1 root root 0 2008-03-13 16:29 apache.conf
-rw-r–r– 1 root root 0 2008-03-14 02:50 data.conf
-rw-r–r– 1 root root 0 2008-03-14 02:50 demo.conf
-rw-r–r– 1 root root 0 2008-03-14 02:50 main.conf
-rw-r–r– 1 root root 0 2008-03-14 02:50 readme.conf
-rw-r–r– 1 root root 0 2008-03-14 02:50 sample.conf
root@arunbagul:/home/arun#
Supose After some time we want to revert back!! ie want to rename *.conf file as *.
Run the above command and change the extension on command line as shown below
root@arunbagul:/home/arun# ./rename.sh /home/arun/templates/ conf txt
Rename all the *.conf files as .txt files…
Directory is = /home/arun/templates
renaminng /home/arun/templates/demo.conf to /home/arun/templates/demo.txt
renaminng /home/arun/templates/apache.conf to /home/arun/templates/apache.txt
renaminng /home/arun/templates/readme.conf to /home/arun/templates/readme.txt
renaminng /home/arun/templates/data.conf to /home/arun/templates/data.txt
renaminng /home/arun/templates/main.conf to /home/arun/templates/main.txt
renaminng /home/arun/templates/sample.conf to /home/arun/templates/sample.txt
root@arunbagul:/home/arun#
root@arunbagul:/home/arun# ll /home/arun/templates/
total 0
-rw-r–r– 1 root root 0 2008-03-13 16:29 apache.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 data.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 demo.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 main.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 readme.txt
-rw-r–r– 1 root root 0 2008-03-14 02:50 sample.txt
root@arunbagul:/home/arun#
Want to see the code ?
root@arunbagul:/home/arun# cat /home/arun/rename.sh
#! /bin/bash
path=$1
old_extension=$2
new_extension=$3
echo “Rename all the *.$old_extension files as .$new_extension files…”
#remove the trailing ‘/’ from end of the path
path=”${path%/}”
echo “Directory is = $path”
#Now, move/rename the files with given condition
#use ‘find’ command to find file path with given old extensions
for file_name in $(find $path -type f -name “*.${old_extension}”)
do
echo “renaminng $file_name to ${file_name%.${old_extension}}.${new_extension}”
mv -f $file_name ${file_name%.${old_extension}}.${new_extension}
done
#done
root@arunbagul:/home/arun#
NOTE :- Remember that this script is using ‘find’ command to find the files with given extensions
before renaming the files.. As ‘find’ command has no options to limit searching of files non recursively..
But still we can achieve non recursive renaming of files with same pattern matching and
string operation funcationality of shell script… please visit again!!
Thank you,
Arun Bagul
Introduction -
Some time you want your shell script to be binary executable. You can do this by using the tool called Shell script compiler (shc).
shc creates a stripped binary executable version of the shell script specified with -f on the command line. There is no speed increase from using shc.
Its main purpose is to prevent your shell scripts from being easily modified or inspected. shc can wrap scripts written for any shell.
1] How to install shc on Ubuntu/Debian system -
root@arunbagul:~# apt-get install shc
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
shc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 19.7kB of archives.
After unpacking 90.1kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com gutsy/universe shc 3.8.6-2 [19.7kB]
Fetched 19.7kB in 1s (14.8kB/s)
Selecting previously deselected package shc.
(Reading database … 88932 files and directories currently installed.)
Unpacking shc (from …/archives/shc_3.8.6-2_i386.deb) …
Setting up shc (3.8.6-2) …
root@arunbagul:~#
2] Sample shell script -
root@arunbagul:~# vim myscript.sh
root@arunbagul:~# cat myscript.sh
#! /bin/bash
echo -n “Welcome to shell script…”
echo -e “\n——————————–”
echo -n “Enter the number: ”
read num1
echo -n “Enter the number: ”
read num2
sum=$(expr $num1 + $num2)
echo -n “Sum to $num1 and $num2 = $sum”
echo -e “\ndone.”
root@arunbagul:~# chmod 755 myscript.sh
root@arunbagul:~#
root@arunbagul:~# ./myscript.sh
Welcome to shell script…
——————————–
Enter the number: 40
Enter the number: 50
Sum to 40 and 50 = 90
done.
root@arunbagul:~#
3] Steps to convert shell script to binary executable-
root@arunbagul:~# pwd
/root
root@arunbagul:~# ls
myscript.sh
root@arunbagul:~# shc -r -f myscript.sh
root@arunbagul:~# ls
** check in current working directory the binary file of you shell is created. You can deploy this script on any system (linux/Unix) for that you need to mention the options “-r” as shown in above command. please read shc man pages for more details.
Thank you,
Arun Bagul
#!/bin/bash -x
# This script is useful for taking backup on Tape
# Tested on CentOS 3.8, CentOS 4.4
# For further info please login http://indianGNU.org or
# mail ravi <at> indianGNU.org
##### DECLARE AND INITIALIZE VARIABLES #####
### File with the full path names ###
DATE=`date +%m-%d-%g`
LOGDIR=/usr/local/admin/backup
BKDIR=/root/backup
TAPE1=$BKDIR/tape1
TAPE2=$BKDIR/tape2
TOC1=$LOGDIR/backup.$DATE/toc1
TOC2=$LOGDIR/backup.$DATE/toc2
ERR=$LOGDIR/backup.$DATE/errorlogs
GTAR=/bin/gtar
TAPE=/dev/st0
MT=/bin/mt
CP=/bin/cp
mkdir /usr/local/admin/backup/backup.$DATE
### Loop the the backup directory files ###
sleep 60
#$TIME > $TOC1
if [ -f "$TAPE1" ]; then
$MT -f $TAPE rewind;
$GTAR -cvf $TAPE -V “Tape1-Full.$DATE” $TAPE1
$CP $TAPE1 $TAPE2 $LOGDIR
for DIR1 in `cat $TAPE1`
do
$GTAR –exclude “simulation” -cvf $TAPE $DIR1 >> $TOC1 2>> $ERR
sleep 60;
done
$GTAR -cvf $TAPE $TOC1
$MT -f $TAPE rewoff
fi
### Loop the the backup directory files ###
sleep 180
#$TIME > $TOC2
if [ -f "$TAPE2" ]; then
$MT -f $TAPE rewind;
$GTAR -cvf $TAPE -V “Tape2-Full.$DATE” $TAPE2
for DIR2 in `cat $TAPE2`
do
$GTAR –exclude “simulation” -cvf $TAPE $DIR2 >> $TOC2 2>> $ERR
sleep 60;
done
$GTAR -cvf $TAPE $TOC2
$MT -f $TAPE rewoff
fi
#################################################
# Needed Additions to the backup script are: #
# Put table of contents on the end of the tape #
# Rotate through four sets of table of contents #
# in /usr/local/admin/backups #
#################################################
Thanks & Regards
Hi All,
These two scripts are very important for the system admin who regularly works with mail servers and somehow forgets to backup his system username and password! Let’s say somehow we lost the usernames and passwords of the mail server. In this case the admin has to manually create all the users and then change the passwords for all the users. Tedious job. Let’s make our life easier.
First create a file which contains all the user name. Something like this:
root@indiangnu.org:/home/arun# vi userlist.txt
Arun
Nishikant
Ali
Nishit
Ameya
Yogesh
Santosh
Save the file as userlist.txt. Now create the following bash file:
root@indiangnu.org:/home/arun# vi useradd
#!/bin/sh
# This script is useful for adding user
do
echo $i
adduser $i
done
Save the file and exit.
root@indiangnu.org:/home/arun# chmod 755 userlist.txt useradd
Now run the file :
root@indiangnu.org:/home/arun# ./useradd
This will add all the users to the system. Now we have to change the passwords. Let’s say we want username123 as password. So for user arun the password will be arun123, ravi123 for user ravi and so on.
Create another bash file as follows:
root@indiangnu.org:/home/arun# vi userpass
#!/bin/sh
# This script is useful for changing user’s password
# Changing password using this script user must have to change password after next login
for i in `more userlist.txt`
do
echo $i
echo $i”123″ | passwd –stdin “$i”
echo; echo “User $i will be forced to change password on next login!”
done
Save the file and exit.
root@indiangnu.org:/home/arun# chmod 755 userpass
Run the file. All the passwords are changed.
The useradd and password changed one time bash script is available below
root@indiangnu.org:/home/arun# vi adduser
#!/bin/sh
# This user.sh script is useful for creating
# bulk number of user account with their password
# This script created by Ravi Bhure (date:14/01/2008)
# For further info please login http://indianGNU.org or
# mail ravi <at> indianGNU.org
#
for i in `more userlist.txt`
do
echo $i
adduser $i
echo $i”123″ | passwd –stdin “$i”
echo; echo “User $i’s password changed!”
echo; echo “User $i will be forced to change password on next login!”
done
changed the permission 755 “useradd” file.
Thank You
#!/bin/sh
# Shell script to monitor or watch the disk space
# It will send an email to $ADMIN, if the (free avilable) percentage
# of space is >= 90%
# ————————————————————————-
# Linux shell script to watch disk space (should work on other UNIX oses )
# SEE URL: http://www.indiangnu.org
# set admin email so that you can get email
ADMIN=”ravi@indiangnu.org”
# set alert level 90% is default
ALERT=90
df -H | grep -vE ‘^Filesystem|tmpfs|cdrom’ | awk ‘{ print $5 ” ” $1 }’ | while read output;
do
#echo $output
usep=$(echo $output | awk ‘{ print $1}’ | cut -d’%’ -f1 )
partition=$(echo $output | awk ‘{ print $2 }’ )
if [ $usep -ge $ALERT ]; then
echo “Running out of space \”$partition ($usep%)\” on $(hostname) as on $(date)” |
mail -s “Alert: Almost out of disk space $usep” $ADMIN
fi
done
=================
Thank You,
Ravi Bhure
#!/bin/bash
# Shell script to monitor running services such as web/http, ssh, mail etc.
# If service fails it will send an Email to ADMIN user
# ————————————————————————-
# See URL for more info
# http://www.indiangnu.org
# —————————————————
# service port
ports=”22 80 25″
# service names as per above ports
service=”SSH WEB MAIL”
# No of services to monitor as per (above ports+1)
SCOUNTER=4
#Email id to send alert
ADMINEMAIL=”ravi@indiangnu.org”
# counter
c=1
echo “Running services status:”
# use sudo if you want i.e. sudo /bin/netstat
/bin/netstat -tulpn | grep -vE ‘^Active|Proto’ | while read LINE
do
sendMail=0
# get active port name and use : as delimiter
t=$(echo $LINE | awk ‘{ print $4}’ | cut -d: -f2)
[ "$t" == "" ] && t=-1 || :
# get service name from $services and : as delimiter
sname=$(echo $service | cut -d’ ‘ -f$c)
sstatus=”$sname: No”
# now compare port
for i in $ports
do
if [ $i -eq $t ]; then
sstatus=”$sname: Ok”
sendMail=1
fi
done
# display service status as OK or NO
echo “$sstatus”
#next service please
c=$( expr $c + 1 )
[ "$sendMail" == "0" ] && echo $sstatus | mail -s “service down $sstatus” $ADMINEMAIL || :
# break afer 3 services
[ $c -ge $SCOUNTER ] && break || :
done
==========================
Thank you
Ravi Bhure
This script is useful for start and stop oracle services in *nix OS.
Put this script in /etc/init.d/ with name oracle-start-stop-service.sh & change its permission to 555 (-r-xr-xr-x).
====================
#!/bin/bash
# oracle-start-stop-service.sh
# Run level script to start Oracle 10g services on RedHat Enterprise Linux (RHAS 4)
# Script should work on other UNIX like oses
# ————————————————————————-
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle service
# ————————————————————————-
# Before using this script check & edit what are your appropriate path and user credentials.
#
OUSER=”oracle”
OPATH=”/home/oracle/oracle/product/10.2.0/db_1″
# check Oracle db status
function chkdb_status() {
# set username
SUSER=”scott”
# set password
SPASS=”123456″
sqlplus -s /nolog > /dev/null 2>&1 <<EOF
whenever sqlerror exit failure
connect $SUSER/$SPASS
exit success
EOF
if [ $? -ne 0 ]; then
echo “Connection failed : DB is down”
exit 1
else
echo “Connection succeeded : DB is up”
fi
}
case “$1″ in
start)
echo “*** Starting Oracle *** ”
su - $OUSER -c “$OPATH/bin/lsnrctl start”
su - $OUSER -c “$OPATH/bin/dbstart”
;;
stop)
echo “*** Stopping Oracle *** ”
su - $OUSER -c “$OPATH/bin/lsnrctl stop”
su - $OUSER -c “$OPATH/bin/dbshut”
;;
restart)
$0 stop
$1 start
;;
isqlstart)
echo “*** Starting Oracle iSQL Plus *** ”
su - $OUSER -c “$OPATH/bin/isqlplusctl start”
echo “*** Note: You can access service at url: http://$(hostname):5560/isqlplus”
;;
isqlstop)
echo “*** Stopping Oracle iSQL Plus *** ”
su - $OUSER -c “$OPATH/bin/isqlplusctl stop”
;;
emstart)
echo “*** Starting Oracle Enterprise Manager 10g Database Control ***”
su - $OUSER -c “$OPATH/bin/emctl start dbconsole”
echo “*** Note: You can access service at url: http://$(hostname):1158/em”
;;
emstop)
echo “*** Stopping Oracle Enterprise Manager 10g Database Control ***”
su - $OUSER -c “$OPATH/bin/emctl stop dbconsole”
;;
status)
echo “*** Oracle database status ***”
chkdb_status
;;
*)
echo $”Usage: $0 {start|stop|isqlstart|isqlstop|emstart|emstop}”
exit 1
esac
exit 0
===================
Thank you
Ravi Bhure