Skip to content

Instantly share code, notes, and snippets.

@miyucy
Last active December 5, 2017 06:57
Show Gist options
  • Save miyucy/e986d27baf8b3a24a05eb04c8e932dff to your computer and use it in GitHub Desktop.
Save miyucy/e986d27baf8b3a24a05eb04c8e932dff to your computer and use it in GitHub Desktop.
ORCAパッチを手動であてる
sudo -u orca bash program_upgrade_download.sh
vi /var/lib/jma-receipt/patch/patch-file-list
sudo -u orca bash program_upgrade_apply.sh

patch-file-listの中身をいじる

patch500-20170206-1.tar.gz
patch500-20170222-1.tar.gz
patch500-20170327-1.tar.gz
patch500-20170328-1.tar.gz
patch500-20170404-1.tar.gz
patch500-20170410-1.tar.gz
patch500-20170426-1.tar.gz
patch500-20170525-1.tar.gz
patch500-20170626-1.tar.gz
patch500-20170628-1.tar.gz
patch500-20170725-1.tar.gz
patch500-20170802-1.tar.gz
patch500-20170824-1.tar.gz
patch500-20170921-1.tar.gz
patch500-20171024-1.tar.gz
patch500-20171127-1.tar.gz
#!/bin/bash
JMARECEIPT_ENV="/etc/jma-receipt/jma-receipt.env"
if [ ! -f ${JMARECEIPT_ENV} ]; then
echo "${JMARECEIPT_ENV} does not found."
exit 1
fi
. $JMARECEIPT_ENV
if [ `whoami` != "${ORCAUSER}" ]; then
echo "${ORCAUSER}ユーザーで実行してください。"
exit 1
fi
COB_LIBRARY_PATH="$PATCHLIBDIR":"$ORCALIBDIR":"$PANDALIB"
export COB_LIBRARY_PATH
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB -parameter "JBS0000001PRGMNT,01"
PATH=$SITESCRIPTSDIR/allways:$PATCHSCRIPTSDIR/allways:$SCRIPTSDIR/allways:$PATH
JMARECEIPT_ENV="/etc/jma-receipt/jma-receipt.env"
if [ ! -f ${JMARECEIPT_ENV} ]; then
echo "${JMARECEIPT_ENV} does not found."
exit 1
fi
. $JMARECEIPT_ENV
umask 022
METHOD="update"
HOSPNUM="01"
PRGDIR=/var/tmp/orca-prg5.0.0
PATCHDIR=/var/lib/jma-receipt/patch
PACKAGEFILE=patch5.0.0.gz
PRGPATH=$PGUPGRADEPATH/5.0.0
PATCHLIST=$PATCHDIR/patch-file-list
PATCHMD5=$PATCHDIR/patchmd5.yml
MONINFO=/usr/lib/panda/bin/moninfo
PGUP_WORK_DIR=/tmp/jma-receipt-patch-work
if [ "$METHOD" = "update" ]; then
LOG="$LOGDIR"/program_upgrade_online.log
else
LOG="$LOGDIR"/program_upgrade_check.log
fi
echo ${LOG}
# echo message (default character-code EUC)
echomsg() {
if [ "${LANG}" = "ja_JP.UTF-8" ] || [ "${LANG}" = "ja_JP.utf8" ]; then
echo `echo $1 | nkf -wE`
else
echo $1
fi
}
jobend97() {
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB2 -parameter "JBE0000001PRGMNT 9700,$HOSPNUM,,,${1}"
rm -rf $PRGDIR
exit 97
}
#PGUPGRADEPATH=file:///cdrom/pub/bugfix/ubuntu/@ARCHITECTURE@/@DISTCODENAME@
OFFLINEPATH=`echo $PRGPATH | sed -ne 's#file://##p'`
if [ -z $OFFLINEPATH ]; then
OFFLINE="online"
else
OFFLINE="offline"
PRGPATH=$OFFLINEPATH
fi
echomsg "${OFFLINE}" ${LOG}
if ! [ -d $PRGDIR ]; then
mkdir $PRGDIR
fi
rm -rf $PRGDIR/*
echomsg "${PACKAGEFILE}" ${LOG}
echomsg "${PRGPATH}" ${LOG}
export PACKAGEFILE
export PATCHDIR
export PRGPATH
export CACERTFILE
export PATCHLIST
rm -f $PATCHMD5
touch $PATCHMD5
export PRGDIR
export PATCHMD5
if [ ! -e $PATCHLIST ]; then
RESULT="[ERROR] $PATCHLIST not found"
jobend97 "${RESULT}"
fi
# vi /var/lib/jma-receipt/patch/patch-file-list
for file in `cat $PATCHLIST`
do
echomsg "$file Execute." ${LOG}
rm -rf $PRGDIR/*
if [ -e $PATCHDIR/$file ]; then
tar zxf $PATCHDIR/$file -C $PRGDIR
if [ $? -ne 0 ]; then
RESULT="[ERROR] tar zxf $file"
jobend97 "${RESULT}"
fi
mv $PRGDIR/patch/* $PRGDIR
rmdir $PRGDIR/patch
if [ "$METHOD" = "update" ]; then
bash $PRGDIR/PROCEDURE $PRGDIR
else
bash $PRGDIR/INITIATOR $PRGDIR
fi
if [ $? -ne 0 ]; then
RESULT="[ERROR] $file/Execute Error"
jobend97 "${RESULT}"
fi
LOGMSG=`program_upgrade_patchmd5.rb 2>&1`
RESULT=`echo "$LOGMSG" | head -1`
if [ "[ERROR]" = "${RESULT:0:7}" ] ; then
echomsg "faild in the md5 list." ${LOG}
echomsg "${LOGMSG}" ${LOG}
jobend97 "${RESULT}"
fi
fi
done
rm -rf $PRGDIR
LOGMSG=`program_upgrade_verify.rb 2>&1`
RESULT=`echo "$LOGMSG" | head -1`
if [ "[ERROR]" = "${RESULT:0:7}" ] ; then
echomsg "faild in the verify." ${LOG}
echomsg "${LOGMSG}" ${LOG}
jobend97 "${RESULT}"
fi
if [ "$METHOD" = "update" ]; then
echomsg "site-upgrade start." ${LOG}
site-upgrade.sh >> ${LOG}
echomsg "site-upgrade end." ${LOG}
fi
if [ "$METHOD" = "update" ]; then
#monitor restart (SIGHUP)
if [ -e /var/run/jma-receipt/monitor.pid ]; then
if [ -z "$PGUPGRADE_RESTART_LIMIT" ]; then
#set default 30 second
PGUPGRADE_RESTART_LIMIT=31
fi
if [ $PGUPGRADE_RESTART_LIMIT -ne 0 ]; then
CONN_NUMBER=`$MONINFO who | wc -l`
if [ $CONN_NUMBER -gt 1 ]; then
disp_sec=`printf "%02d" ${PGUPGRADE_RESTART_LIMIT}`
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB2 -parameter "JBE0000001PRGMNT 51${disp_sec},${HOSPNUM},,,"
fi
fi
limit_sec=0
while [ $limit_sec -ne $PGUPGRADE_RESTART_LIMIT ]
do
sleep 1
CONN_NUMBER=`$MONINFO who | wc -l`
if [ $CONN_NUMBER = 1 ]; then
echomsg "there is no terminal under the connection." ${LOG}
break
fi
limit_sec=`expr $limit_sec + 1`
work_sec=`expr ${PGUPGRADE_RESTART_LIMIT} - $limit_sec`
disp_sec=`printf "%02d" $work_sec`
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB2 -parameter "JBE0000001PRGMNT 51${disp_sec},${HOSPNUM},,,"
done
if [ $CONN_NUMBER -gt 1 ]; then
NOTICE_MSG="端末は強制終了しました。"
echomsg "moninfo abortall go! $NOTICE_MSG" ${LOG}
$MONINFO abort-all $NOTICE_MSG
sleep 4
fi
echomsg "monitor restart." ${LOG}
if [ -d ${PGUP_WORK_DIR}/record ]; then
cp -rp ${PGUP_WORK_DIR}/record ${PATCHLIBDIR}
fi
kill -HUP `cat /var/run/jma-receipt/monitor.pid`
cp -rp ${PGUP_WORK_DIR}/* ${PATCHLIBDIR}
rm -rf ${PGUP_WORK_DIR}
else
RESULT="[ERROR] monitor.pid is not found. don't start again."
echomsg "${RESULT}" ${LOG}
jobend97 "${RESULT}"
fi
fi
echomsg "patch program processing succeeded." ${LOG}
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB2 -parameter "JBE0000001PRGMNT 0000,${HOSPNUM},,,"
exit $?
#!/bin/bash
JMARECEIPT_ENV="/etc/jma-receipt/jma-receipt.env"
if [ ! -f ${JMARECEIPT_ENV} ]; then
echo "${JMARECEIPT_ENV} does not found."
exit 1
fi
. $JMARECEIPT_ENV
if [ `whoami` != "${ORCAUSER}" ]; then
echo "${ORCAUSER}ユーザーで実行してください。"
exit 1
fi
COB_LIBRARY_PATH="$PATCHLIBDIR":"$ORCALIBDIR":"$PANDALIB"
export COB_LIBRARY_PATH
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB -parameter "JBS0000001PRGMNT,01"
PATH=$SITESCRIPTSDIR/allways:$PATCHSCRIPTSDIR/allways:$SCRIPTSDIR/allways:$PATH
JMARECEIPT_ENV="/etc/jma-receipt/jma-receipt.env"
if [ ! -f ${JMARECEIPT_ENV} ]; then
echo "${JMARECEIPT_ENV} does not found."
exit 1
fi
. $JMARECEIPT_ENV
umask 022
METHOD="update"
HOSPNUM="01"
PRGDIR=/var/tmp/orca-prg5.0.0
PATCHDIR=/var/lib/jma-receipt/patch
PACKAGEFILE=patch5.0.0.gz
PRGPATH=$PGUPGRADEPATH/5.0.0
PATCHLIST=$PATCHDIR/patch-file-list
PATCHMD5=$PATCHDIR/patchmd5.yml
MONINFO=/usr/lib/panda/bin/moninfo
PGUP_WORK_DIR=/tmp/jma-receipt-patch-work
if [ "$METHOD" = "update" ]; then
LOG="$LOGDIR"/program_upgrade_online.log
else
LOG="$LOGDIR"/program_upgrade_check.log
fi
echo ${LOG}
# echo message (default character-code EUC)
echomsg() {
if [ "${LANG}" = "ja_JP.UTF-8" ] || [ "${LANG}" = "ja_JP.utf8" ]; then
echo `echo $1 | nkf -wE`
else
echo $1
fi
}
jobend97() {
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB2 -parameter "JBE0000001PRGMNT 9700,$HOSPNUM,,,${1}"
rm -rf $PRGDIR
exit 97
}
#PGUPGRADEPATH=file:///cdrom/pub/bugfix/ubuntu/@ARCHITECTURE@/@DISTCODENAME@
OFFLINEPATH=`echo $PRGPATH | sed -ne 's#file://##p'`
if [ -z $OFFLINEPATH ]; then
OFFLINE="online"
else
OFFLINE="offline"
PRGPATH=$OFFLINEPATH
fi
echomsg "${OFFLINE}" ${LOG}
if ! [ -d $PRGDIR ]; then
mkdir $PRGDIR
fi
rm -rf $PRGDIR/*
echomsg "${PACKAGEFILE}" ${LOG}
echomsg "${PRGPATH}" ${LOG}
export PACKAGEFILE
export PATCHDIR
export PRGPATH
export CACERTFILE
export PATCHLIST
LOGMSG=`cachedl.rb 2>&1`
RC=$?
RESULT=`echo "$LOGMSG" | head -1`
if [ "[ERROR]" = "${RESULT:0:7}" ] ; then
echomsg "faild in the download of the patch program." ${LOG}
echomsg "${LOGMSG}" ${LOG}
jobend97 "${RESULT}"
else
if [ $RC -ne 0 ]; then
$DBSTUB -dir $LDDIRECTORY -bd orcabt ORCBJOB2 -parameter "JBE0000001PRGMNT 0100,$HOSPNUM,,,"
exit 0
fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment