File: dbcheck.sh

package info (click to toggle)
watchdog 5.4-10lenny2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 936 kB
  • ctags: 684
  • sloc: ansic: 6,294; sh: 1,266; makefile: 72
file content (29 lines) | stat: -rwxr-xr-x 489 bytes parent folder | download | duplicates (8)
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
#!/bin/sh

#
# check if ORACLE database instance is still reacting to ping requests
#

#
# name of the instance (must be defined in tnsnames.ora)
#
DATABASE=$1

#
# check the state:
# tnsping returns 0 on success, otherise the return value is 1
#
tnsping $DATABASE > /dev/null 2>&1
result=$?

if [ $result -ne 0 ]
then
#
#	obviously there is no system error code for this
#	so we have to create our own (system codes are > 0): -2.
#	note that -1 means reboot
#
	result=-2
fi

exit $result