d
Once you have setup the nuxeo configuration files and tested the server etc, it is advisable to add a startup script, so that in the case that the machine is rebooted for any reason (e.g. after installation of updates or a power failure), the nuxeo server will start automatically.
Requirement:
1. Nuxeo Software package for windows(http://www.nuxeo.com/en/downloads)
2. YAJSW (http://sourceforge.net/projects/yajsw/files/)
NUXEO_HOME = path where the Nuxeo server will be installed ( C:\Nuxeo\ in below example)
YAJSW_HOME = path where our YAJSW package is extracted (C:\yajsw\ in below example)
NUXEO_CONF = path to the Nuxeo Configuration File (C:\ProgramData\Nuxeo\conf\nuxeo.conf in below example)
1. Create a folder named "yajsw" inside C:\ drive and extract the YAJSW zip file inside C:\yajsw\ .
So that the YAJSW home path should like "C:\yajsw" and it should contain the bin, conf, etc.
2. Set the system environment variable NUXEO_CONF to the location of your nuxeo.conf file. To do this open the Command Prompt (with Administrative privilege)
and execute below command:
setx -m NUXEO_CONF C:\ProgramData\Nuxeo\conf\nuxeo.conf
To ensure that the environment variable is set properly, in command prompt and type
echo %NUXEO_CONF%
This will the print the NUXEO_CONF path.
3. In the command prompt, go to %NUXEO_HOME%\bin\ folder and execute "nuxeoctl.bat --gui=false start" command:
C:\Nuxeo\bin>nuxeoctl.bat --gui=false start
Once the server is started, you'll get a message like below where XXXX is the process ID of the running Nuxeo application:
"Server started with process ID XXXX."
Don't close this Command Prompt, we will need this for other steps.
4. Now open another Command Prompt(with Administrative privilege) and go to %YAJSW_HOME%\bat folder.
Execute the genConfigcommand with the process ID as parameter:
C:\yajsw\bat>genConfig.bat XXXX
This command will write to the wrapper.conf file at %YAJSW_HOME%\conf\ location. i.e. to C:\yajsw\conf\wrapper.conf file.
5. Open the wrapper.conf file and make sure the wrapper.console.title entry does not contain a colon (":") or the runConsole.bat will fail.
Just remove the colon or give another title.
6. Stop the Nuxeo DM server by executing below command from %NUXEO_HOME%\bin location
C:\Nuxeo\bin>nuxeoctl.bat --gui=false stop
7. Now,to execute your wrapped application as console application by calling this command and check your application is accessible from
%YAJSW_HOME%\bat location:
C:\yajsw\bat>runConsole.bat
8. Now, give a custom name to our service by opening the C:\yajsw\conf\wrapper.conf file and setting below parameters:
# Name of the service
wrapper.ntservice.name=NuxeoDM
# Display name of the service
wrapper.ntservice.displayname=Nuxeo DM
# Description of the service
wrapper.ntservice.description=Service to manage Nuxeo DM
9. To install as service, go to %YAJSW_HOME%\bat folder and execute the installService.bat
C:\yajsw\bat>installService.bat
Your service is installed and you can run Nuxeo DM from its service ("Windows Computer Management > Services" on Windows 7).
10. Change the service user from "Local Service" to a local administrator. The reason for this is that certain functionalities will not work correctly, e.g. generating previews for PDF documents.
Create “init.d” Script
Create a script named “casebrowser” in /etc/init.d/ folder first.
cd /etc/init.d sudo vi casebrowser |
Copy the following lines into the file, and modify parameters accordingly.
#!/bin/sh # CaseBrowser Startup Script export CATALINA_HOME=/path/to/casebrowser export JAVA_HOME=/path/to/jdk # the user who runs casebrowser export TOMCAT_OWNER=tomcat start() { echo -n "Starting Tomcat: " su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh sleep 2 } stop() { echo -n "Stopping Tomcat: " su $TOMCAT_OWNER -c $CATALINA_HOME/bin/shutdown.sh } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: tomcat {start|stop|restart}" exit esac |
After saving the file, make sure to grant correct permission to this script file.
sudo chmod 755 casebrowser |
In order to be called when system boots, we need to create a link in /etc/rc3.d/ folder from the corresponding script in /etc/init.d/ folder.
cd /etc/rc3.d/ sudo ln -s ../init.d/casebrowser S100CaseBrowser |
Now, we can restart the linux server and test if the casebrowser is started automatically.
CaseBrowser zip is a Tomcat instance, the official guide here (http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html) is exactly suitable for casebrowser. Just need to rename tomcat7 to casebrowser whenever possible.