Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue when chkonfig already exists; making shmfs fix and service script header persistent #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions files/default/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* eol=lf
9 changes: 9 additions & 0 deletions files/default/oracle-xe-init-header
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: OracleXE
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Oracle 11g Express Edition
### END INIT INFO
2 changes: 1 addition & 1 deletion files/default/oracle.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
fs.file-max=6815744
net.ipv4.ip_local_port_range=9000 65000
kernel.sem=250 32000 100 128
kernel.shmmax=536870912
kernel.shmmax=1073741824
33 changes: 31 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@
creates '/var/lock/subsys'
end

cookbook_file '/etc/sysctl.d/60-oracle.conf ' do
cookbook_file '/etc/sysctl.d/60-oracle.conf' do
action :create
source 'oracle.conf'
mode 644
end

execute 'backup chkconfig if exists' do
command 'mv /sbin/chkconfig /sbin/chkconfig.bak'
creates '/sbin/chkconfig.bak'
only_if "test -f /sbin/chkconfig"
end

cookbook_file '/sbin/chkconfig' do
action :create
source 'chkconfig'
Expand All @@ -63,6 +69,11 @@
creates '/u01/app/oracle'
end

execute 'restore chkconfig from backup' do
command 'mv -f /sbin/chkconfig.bak /sbin/chkconfig'
only_if "test -f /sbin/chkconfig.bak"
end

service "oracle-xe" do
action :nothing
supports :status => true, :start => true, :stop => true, :restart => true
Expand All @@ -73,8 +84,12 @@
umount /dev/shm
rm /dev/shm -rf
mkdir /dev/shm
mount -t tmpfs shmfs -o size=2048m /dev/shm

echo -e 'shmfs\t/dev/shm\ttmpfs\tsize=2g\t0\t0\n' >> /etc/fstab
mount shmfs

sysctl kernel.shmmax=1073741824

touch /dev/shm/.shmfix
}
not_if { ::File.exists?('/dev/shm/.shmfix') }
Expand Down Expand Up @@ -102,6 +117,20 @@
creates '/home/oracle/.oracle_environment_vars'
end

cookbook_file "/tmp/oracle-xe" do
source "oracle-xe-init-header"
mode 755
end

bash 'correct and reinstall service script' do
code %Q{
cat /etc/init.d/oracle-xe >> /tmp/oracle-xe
cp -f /tmp/oracle-xe /etc/init.d/oracle-xe
update-rc.d oracle-xe defaults 80 01
}
not_if "head /etc/init.d/oracle-xe -n3 | grep INIT"
end

execute 'configure_oracle' do
command '/etc/init.d/oracle-xe configure responseFile=/tmp/oracle_xe.rsp && touch /home/oracle/.oracle_configured'
action :run
Expand Down