On Mon, Apr 06, 2020 at 01:43:57PM -0700, tony mancill wrote:

> On Fri, Dec 30, 2016 at 12:15:45PM +0100, Karsten Hilbert wrote:
> > On Fri, Dec 30, 2016 at 10:57:56AM +0100, Sébastien Jodogne wrote:
> >
> > > Sorry, my mistake: Preventing Orthanc from starting after an upgrade of 
> > > the
> > > database schema was on my TODO list... it is not implemented yet. I have
> > > just added an issue on the upstream bug tracker to avoid forgetting it:
> > > https://bitbucket.org/sjodogne/orthanc/issues/29
> > >
> > > This feature will be part of forthcoming 1.2.1 release.
> >
> > Thanks a lot for confirming. I will test when 1.2.1 is out
> > and provide a script users can run updating the database
> > schema if needed.
>
> Hello Karsten,
>
> Debian stable now has version 1.5.6 [1] and the upstream bug report is
> marked as resolved [2].  Is a separate update script still needed?  If
> not, can this bug report be closed?

A separate script is never needed because Orthanc itself can
upgrade it's database -- if manually invoked in the right
environment.

The (attached) script makes it a lot easier for users to do
so and it proves (on my machine) that the surprising behaviour
(Orthanc being started after a run with --upgrade) is fixed.

So, the bug can be closed, regardless of the attached script
-- but the attached script is useful to users whenever
another database upgrade comes along (which there will,
eventually).

Best,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
#!/bin/bash

#-------------------------------------------------
# GPLv2 or later, Karsten Hilbert

#set -x

LOGDIR=/var/log/orthanc
LOGFILE=${LOGDIR}/upgrade.log
ARGS="--upgrade --trace /etc/orthanc/"
ORTHANC_BINARY=`which Orthanc`


echo "Stopping Orthanc server..."
echo "#-----------" &> ${LOGFILE}
systemctl stop orthanc.service &>> ${LOGFILE}
RESULT=$?
echo "#-----------" &>> ${LOGFILE}
systemctl status orthanc.service &>> ${LOGFILE}
sleep 1s
if [ ${RESULT} -ne 0 ] ; then
    echo "#-----------" &>> ${LOGFILE}
    systemctl status orthanc.service &>> ${LOGFILE}
    echo "Cannot stop Orthanc, please inspect the log: ${LOGFILE}"
    read -p "Press <ENTER> to inspect the log" TMP
    less ${LOGFILE}
    exit ${RESULT}
fi


echo "Attempting database upgrade..."
echo "#-----------" &>> ${LOGFILE}
echo "Running <${ORTHANC_BINARY} ${ARGS}>" >> ${LOGFILE}
sudo -u orthanc ${ORTHANC_BINARY} ${ARGS} &>> ${LOGFILE}
RESULT=$?
if [ ${RESULT} -ne 0 ] ; then
    cat ${ORTHANC_LOG} &>> ${LOGFILE}
    echo "#-----------" &>> ${LOGFILE}
    systemctl status orthanc.service &>> ${LOGFILE}
    echo "Upgrade failed, please check the log: ${LOGFILE}"
    read -p "Press <ENTER> to inspect the log" TMP
    less ${LOGFILE}
    exit ${RESULT}
fi


echo "Restarting Orthanc server..."
sleep 1s
echo "#-----------" &>> ${LOGFILE}
systemctl start orthanc.service &>> ${LOGFILE}
RESULT=$?
if [ ${RESULT} -ne 0 ] ; then
    echo "#-----------" &>> ${LOGFILE}
    systemctl status orthanc.service &>> ${LOGFILE}
    echo "Cannot restart Orthanc, please check the log: ${LOGFILE}"
    read -p "Press <ENTER> to inspect the log" TMP
    less ${LOGFILE}
    exit ${RESULT}
fi


echo ""
echo "Seems successful..."
echo "Log: ${LOGFILE}"
echo ""
systemctl status orthanc.service

#-------------------------------------------------

Reply via email to