-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb2
More file actions
62 lines (62 loc) · 1.36 KB
/
db2
File metadata and controls
62 lines (62 loc) · 1.36 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#
# Run-level Startup script for the DB2 Instance
#
### BEGIN INIT INFO
# Provides: DB2 Express C 10.1
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Startup/Shutdown DB2 Instance
### END INIT INFO
DB2_USER=db2inst1
DB2_USER_DIR=/home/db2inst1
if [ ! -f $DB2_USER_DIR/sqllib/adm/db2start ]
then
echo "DB2 might not have been installed and cannot be started!"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
#DB2 Instance startup
echo -n "Starting DB2 Instance: "
su - $DB2_USER -c ". $DB2_USER_DIR/sqllib/db2profile"
su - $DB2_USER -c "$DB2_USER_DIR/sqllib/adm/db2start"
ret=$?
if [ $ret -eq 0 ]
then
echo "DB2 Instance Started Successfully!"
else
echo "DB2 Instance Failed!"
exit 1
fi
touch /var/lock/db2
echo "OK"
;;
stop)
# DB2 instance shutdown
echo -n "Shutdown DB2 instance: "
su - $DB2_USER -c "$DB2_USER_DIR/sqllib/adm/db2stop"
ret=$?
if [ $ret -eq 0 ]
then
echo "DB2 Shutdown Successful"
else
echo "DB2 Shutdown Failed"
exit 1
fi
rm -f /var/lock/db2
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0