To make sure Nuxeo is running reliably every day, we could configure an auto-restart script as a cron job.

Firstly, create a script for restarting Nuxeo on the Nuxeo server:

 

echo "Executing scheduled nuxeo server restart..."

 

export NUXEO_HOME=/Users/nuxeo/nuxeo-cap-5.9.5-tomcat

export NUXEO_BIN=$NUXEO_HOME/bin

export NUXEO_CONF=${NUXEO_BIN}/nuxeo.conf

export NUXEO_HOST=127.0.0.1

 

${NUXEO_BIN}/nuxeoctl stop

 

echo "Waiting 10 seconds for nuxeo to stop..."

sleep 10

ps aux|grep java|grep nuxeo|grep -v "grep"|awk '{print $2}'|xargs kill -9

 

echo "Restarting..."

${NUXEO_BIN}/nuxeoctl start

 

Please change the variables accordingly.

And then add the following line into the crontab.

0 5 * * 0,3 . $HOME/.bash_profile; $HOME/restart_nuxeo.sh >> $HOME/restart_nuxeo.log 2>&1

 

 

  • No labels