forked from geekcomputers/Shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_alert_log.sh
47 lines (35 loc) · 921 Bytes
/
check_alert_log.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/sh
# Script Name : check_alert_log.sh
# Author : Craig Richards
# Created : 2nd July 2008
# Last Modified :
# Version : 1.0
# Modifications :
# Description : Start/stop the perl script to monitor the Oracle Alert Log
#################################
# Start of procedures/functions #
#################################
################
# Main Program #
################
# Variable Settings
case "$1" in
'start')
# Start the perl script
if [ -f /admin/scripts/check_alert_log.pl ]; then
echo "Starting check_alert_log.pl"
su - oracle -c "nohup /admin/scripts/check_alert_log.pl &"
fi
;;
'stop')
# Stop the perl script
PID=`/usr/bin/ps -ef -u 0 | /usr/bin/fgrep check_alert_log | /usr/bin/grep -v grep | /usr/bin/awk '{print $2}'`
if [ ! -z "$PID" ] ; then
/usr/bin/kill ${PID} >/dev/null 2>&1
fi
;;
*)
echo "usage: /etc/init.d/check_alert_log.sh {start|stop}"
;;
esac
## End of Script