Starting Redwood Platform Automatically with Systemd
You configure Redwood Platform to start automatically on UNIX systems using systemd by specifying a unit file that is compatible with your platform. Create a systemd unit file in /etc/systemd/system
. If the database is running on the same host, check to see which unit file starts it. You specify the database unit in the Wants=
directive.
The following example unit can be used to start Redwood Platform on UNIX systems using systemd. Note that you must customize it according to your needs.
Systemd Unit
Create a file named /etc/systemd/system/redwood-platform.service
with the following contents:
[Unit]
Description=central Redwood Server
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
LimitCORE=infinity
User=redwood
Group=redwood
EnvironmentFile=/opt/redwood/j2ee/cluster/server1/bin/setvars.sh
PIDFile=/opt/redwood/j2ee/cluster/server1/work/tomcat.pid
ExecStart=/opt/redwood/j2ee/cluster/server1/bin/start.sh
ExecStop=/opt/redwood/j2ee/cluster/server1/bin/stop.sh
ExecReload=/opt/redwood/j2ee/cluster/server1/bin/restart.sh
[Install]
WantedBy=multi-user.target
warning
Ensure the user you specify exists! The service will be started as user root if you specify an invalid user; this is a feature of systemd.
tip
If you have exported variables in your setvars.sh
file, you will have to remove the export
keyword as systemd does not support that. In this case it is advised to duplicate setvars.sh
to setvars.systemd
and remove the export
keywords in the latter file, allowing you to start Redwood Platform both using systemd and manually.
Procedure
- Adapt the script to your environment and save it to a file named
redwood-platform.service
in the/etc/systemd/system/
folder. - If the database is on the same host, you must locate the name of the start unit for your database and add it to the
After=
. - Run
chmod +x /opt/redwood/j2ee/cluster/server1/bin/*sh
to make the scripts executable. - Run
sudo systemctl --system daemon-reload
to install the unit; you will have to perform this after every modification of the unit file. - Run
sudo systemctl start redwood-platform.service
to start the service.
See Also
onsiteTopic