Starting and Stopping on Linux
DBmarlin Agent Process​
The DBmarlin agent runs as a Tomcat process. The agent process can be started via a single command agent-start.sh
and stopped via agent-stop.sh
.
The agent-start.sh, agent-stop.sh and agent-status.sh scripts must be run as a dbmarlin user account or other non-root user account with access to the DBmarlin install directory.
Starting DBmarlin agent process​
The 3 ENV
variable must first be set before starting the agent.
export DBMARLIN_AGENT_NAME="My first remote agent"
export DBMARLIN_ARCHIVER_URL=http://dbmarlin-service:9090/archiver
export DBMARLIN_API_KEY=aGVsbG86d29ybGQ=
These could be set using one of these methods;
- Linux service (preferred) - See systemd startup for Linux below.
- User
.profile
or similar for thedbmarlin
user to export the 3 variables. - Create your own wrapper script to export the 3 variable before calling
./agent-start.sh
The agent process (tomcat) can be started with a single agent-start.sh
command.
cd /opt/dbmarlin
./agent-start.sh
Checking the status of DBmarlin agent process​
Check the status of the DBmarlin agent processes with the agent-status.sh
command.
cd /opt/dbmarlin
./agent-status.sh
DBmarlin agent (Running)
Stopping the DBmarlin agent process​
The agent process (tomcat) can be stopped with a single agent-stop.sh
command.
cd /opt/dbmarlin
./agent-stop.sh
systemd startup for Linux​
Systemd is a modern SysV-style init
and rc
replacement for Linux systems which makes use of many modern Linux kernel features. It provides a system and service manager that runs as PID 1 and starts the rest of the system. Systemd is what is responsible for controlling how services are started, stopped, restarted and otherwise managed on modern Linux distributions.
The standard Systemd Service unit files that come with the Linux system or installed by third party applications usually run as root or system user account.
Installing systemd unit files for DBmarlin​
-
Login as the
root
user. -
Create new file
dbmarlin-agent.service
under/etc/systemd/system
with contents like below. Be sure to customize the 3 Environment variable to your own settings and also amend the paths below if you aren't using/opt/dbmarlin/
as the base for your DBmarlin installation.[Unit]
Description=DBmarlin Agent Application Service
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Environment="DBMARLIN_AGENT_NAME=dbmarlin-remote-agent"
Environment="DBMARLIN_ARCHIVER_URL=http://172.30.0.155:9090/archiver"
Environment="DBMARLIN_API_KEY=dXNlcjpwYXNzd29yZA=="
Type=forking
PIDFile=/opt/dbmarlin/tomcat/bin/catalina.pid
ExecStartPre=/usr/bin/rm -f /opt/dbmarlin/tomcat/bin/catalina.pid
ExecStart=/opt/dbmarlin/agent-start.sh
ExecStop=/opt/dbmarlin/agent-stop.sh
ExecStopPost=/bin/rm -f /opt/dbmarlin/tomcat/bin/catalina.pid
PrivateTmp=true
User=dbmarlin
Group=dbmarlin
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target -
Reload the services.
systemctl daemon-reload
-
systemctl list-unit-files | grep dbmarlin
- you should see them listed but disabled which means they won't automatically start on a machine reboot but can be started and stopped manually viasystemctl
systemctl list-unit-files | grep dbmarlin
dbmarlin-agent.service disabled -
systemctl start
- to start the servicessystemctl start dbmarlin-agent
-
systemctl status
- to get the current status of the servicessystemctl status dbmarlin-agent
-
systemctl stop
- to stop the servicessystemctl stop dbmarlin-agent
-
Enable the service to make the service automatically restarts on reboot
systemctl enable dbmarlin-agent
For more on systemd see https://www.redhat.com/sysadmin/getting-started-systemctl