VMとしてubuntu 16.04 OSを使用しています。
コンテナーの作成中に、entrpoint.sh にいくつかのコマンドがありますが、これは機能していないか、期待どおりに動作していませんが、コンテナー内で手動で実行しているときに同じコマンドが機能しています。正確には、ソースから再帰的にコピーする単純な linux cpコマンドです。宛先および unzip コマンド。
私の entrypoint.sh には、次の 3 つのコマンドがあります。
cd /tmp/localization/Tpae7610
unzip \*.zip
cp -r /tmp/localization/Tpae7610/* /home/db2inst1/maximo/
コンテナーの起動時に最後の 2 つのコマンドが機能しません。機能していないと言うと、エラーが発生していないことを意味しますが、ソースの内容が期待どおりに宛先にコピーされておらず、.zip ファイルが解凍されていません。
注:ただし、コンテナ内で手動で実行すると、同じコマンドが期待どおりに機能します。
entrypoint.sh
#!/bin/bash
sysctl -w kernel.shmmni=1024
sysctl -w kernel.shmall=2097152
sysctl -w kernel.msgmnb=65536
sysctl -w kernel.msgmax=65536
sysctl -w kernel.msgmni=4096
sysctl -w kernel.shmmax=4294967296
#set -e
#
# Initialize DB2 instance in a Docker container
#
# # Authors:
# *
#
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
mkdir -p /db2fs
chown db2inst1:db2iadm1 /db2fs
chmod -R 755 /db2fs
#cp /tmp/maxinst.sh /home/db2inst1/maximo/Maximo-7.6-CD/tools/maximo/maxinst.sh
if [ -z "$DB2INST1_PASSWORD" ]; then
echo ""
echo >&2 'error: DB2INST1_PASSWORD not set'
echo >&2 'Did you forget to add -e DB2INST1_PASSWORD=... ?'
exit 1
else
echo "db2inst1:$DB2INST1_PASSWORD" | chpasswd
fi
if [ -z "$LICENSE" ];then
echo ""
echo >&2 'error: LICENSE not set'
echo >&2 "Did you forget to add '-e LICENSE=accept' ?"
exit 1
fi
if [ "${LICENSE}" != "accept" ];then
echo ""
echo >&2 "error: LICENSE not set to 'accept'"
echo >&2 "Please set '-e LICENSE=accept' to accept License before use the DB2 software contained in this image."
exit 1
fi
if [[ $1 = "db2start" ]]; then
echo "Performing botc database start"
if [ ! -d /db2fs/db2inst1 ]; then
echo "Database location does not exist, creating database"
chown -R db2inst1:db2iadm1 /maxdb7605
chown -R db2inst1:db2iadm1 /home/db2inst1/maximo
find /maxdb7605 -type d -exec chmod 755 \{\} \;
find /maxdb7605 -type f -exec chmod 644 \{\} \;
cd /home/db2inst1/maximo
#unzip -o tools.zip && rm tools.zip
#unzip -o applications.zip && rm applications.zip
set -x
cd /home/db2inst1/maximo/tools
if [ ! -f java ]; then
ln -s /home/db2inst1/sqllib/java java
fi
su - db2inst1 <<EOH
db2start
db2 create database maxdb76 on /db2fs dbpath on /db2fs using codeset UTF-8 territory us pagesize 32 K
db2 connect to maxdb76
db2 create bufferpool MAXBUFFPOOL pagesize 32K
db2 grant connect on database to user maximo
db2 GRANT DBADM,SECADM, CREATETAB,BINDADD,CONNECT,CREATE_NOT_FENCED_ROUTINE,IMPLICIT_SCHEMA,LOAD,CREATE_EXTERNAL_ROUTINE,QUIESCE_CONNECT ON DATABASE TO USER maximo
db2 GRANT USAGE on WORKLOAD SYSDEFAULTUSERWORKLOAD TO USER maximo;
db2 create schema maximo authorization maximo
db2 create regular tablespace MAXDATA pagesize 32k managed by automatic storage extentsize 16 overhead 12.67 prefetchsize 16 transferrate 0.18 bufferpool MAXBUFFPOOL dropped table recovery on NO FILE SYSTEM CACHING
db2 grant use of tablespace MAXDATA to user maximo
db2 update db cfg using LOGFILSIZ 5000
db2 update db cfg using LOGPRIMARY 50
db2 update db cfg using LOGSECOND 50
db2 connect reset
db2stop force
db2start
cd /maxdb7605
db2set DB2CODEPAGE=1208
db2 connect to maxdb76
db2 -t -f /maxdb7605/dbschema.sql
db2 -t -f /maxdb7605/dev_grants.sql
db2move maxdb76 LOAD -u maximo -p maximo -l lobs
db2 connect to maxdb76 user maximo using maximo
db2 -x "select 'values nextval for MAXIMO.',sequencename,';' from maxsequence" > /maxdb7605/sequence_update.sql
db2 -t -f /maxdb7605/sequence_update.sql
db2 connect reset
EOH
rm -rf /maxdb7605
set +x
nohup /usr/sbin/sshd -D 2>&1 > /dev/null &
cd /home/db2inst1/maximo/tools/maximo
chmod +x TDToolkit.sh
chmod +x updatedb.sh
dos2unix TDToolkit.sh
dos2unix updatedb.sh
./updatedb.sh
export JAVA_HOME=/opt/ibm/java-x86_64-70
export JRE_HOME=/opt//home/db2inst1/maximoibm/java-x86_64-70/jre
export PATH=${JAVA_HOME}/bin:$PATH
cd /
cd /tmp/localization/Tpae7610
unzip \*.zip
cp -a /tmp/localization/Tpae7610/* /home/db2inst1/maximo/
cd /tmp/localization/Lightning7604
unzip \*.zip
cp -a /tmp/localization/Lightning7604/* /home/db2inst1/maximo/
cd /tmp/localization/BOTC7610
unzip \*.zip
cp -a /tmp/localization/BOTC7610/* /home/db2inst1/maximo/
cd /tmp
#remove localization folder from tmp folder
rm -rf localization
cd /home/db2inst1/maximo/tools/maximo
#./TDToolkit.sh -addlangPT -useexpander
#./TDToolkit.sh -addlangJA -useexpander
#./TDToolkit.sh -addlangDE -useexpander
#./TDToolkit.sh -addlangIT -useexpander
#./TDToolkit.sh -addlangFR -useexpander
#./TDToolkit.sh -addlangES -useexpander
#./TDToolkit.sh -pmpupdatenxtgenui -useexpander
# ./TDToolkit.sh -pmpupdatez_botc -useexpander
chmod -R 777 /home/db2inst1/maximo/tools/maximo/log
#healthcheck looks for this file to indicate the container is initialized
touch /tmp/container_started
while true; do sleep 1000; done
exec "/bin/bash"
#statements
else
su - db2inst1 <<EOH
db2start
db2 catalog db maxdb76 on /db2fs
db2 terminate
db2 connect to maxdb76
EOH
touch /tmp/container_started
while true; do sleep 1000; done
exec "/bin/bash"
fi
sleep 10
fi