Skip to content

Make it more reliable and fully automatic #4

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

Open
wants to merge 4 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
6 changes: 5 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
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
Expand All @@ -65,12 +65,16 @@

bash 'fix /dev/shm problem' do
code %Q{
sed -i 's/ \\[ -e \\/dev\\/shm \\] || ln -s \\/run\\/shm \\/dev\\/shm/ mkdir -p \\/dev\\/shm/' /etc/init/mounted-dev.conf
echo "shm /dev/shm tmpfs size=2g 0 0" >> /etc/fstab

umount /dev/shm
rm /dev/shm -rf
mkdir /dev/shm
mount -t tmpfs shmfs -o size=2048m /dev/shm
sysctl kernel.shmmax=1073741824
}
not_if "grep '/dev/shm' /etc/fstab"
end

bash 'setup oracle user' do
Expand Down
31 changes: 19 additions & 12 deletions templates/default/configure_oracle.sh.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#!/usr/bin/expect

set timeout -1
exp_internal 600 # max 10 min
spawn /etc/init.d/oracle-xe configure
expect -re "Specify the HTTP port that will be used for Oracle" {
send "<%= @http_port %>\r"
expect -re "Specify a port that will be used for the database listener"
send "<%= @listener_port %>\r"
expect -re "Specify a password to be used for database accounts.*initial configuration:$"
send "<%= @sysdba_password %>\r"
expect -re "Confirm the password"
send "<%= @sysdba_password %>\r"
expect -re "to be started on boot"
send "y\r"
expect "Installation completed successfully."
expect eof
expect {
-re "Specify the HTTP port that will be used for Oracle" {
send "<%= @http_port %>\r"
expect -re "Specify a port that will be used for the database listener"
send "<%= @listener_port %>\r"
expect -re "Specify a password to be used for database accounts.*initial configuration:$"
send "<%= @sysdba_password %>\r"
expect -re "Confirm the password"
send "<%= @sysdba_password %>\r"
expect -re "to be started on boot"
send "y\r"
expect -re "Installation completed successfully."
expect eof
}
-re "Oracle Database 11g Express Edition is already configured" {exit 0}
eof {exit 1}
timeout {exit 1}
}