> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Doesn't work - Running FlexDeploy as a service with systemctl

> Influx didn’t work with these directions for some reason. Not sure why. Setting up FlexDeploy to run as a service is a nice way to ensure that it alwa

Influx didn’t work with these directions for some reason. Not sure why.

Setting up FlexDeploy to run as a service is a nice way to ensure that it always runs with the correct user, and allows it to be automatically restarted in the event of a problem.

## Directions

vi /etc/systemd/system/flexdeploy.service

```
[Unit]
Description=FlexDeploy
After=syslog.target network.target

[Service]
Type=forking
User=flexdeploy
Group=flexdeploy

Environment=CATALINA_PID=/u01/flexdeploy/apache-tomcat-flexdeploy/temp/tomcat.pid
Environment=CATALINA_HOME=/u01/flexdeploy/apache-tomcat-flexdeploy
Environment=CATALINA_BASE=/u01/flexdeploy/apache-tomcat-flexdeploy

ExecStart=/u01/flexdeploy/StartFlexDeploy.sh
ExecStop=/u01/flexdeploy/StopFlexDeploy.sh

RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
```

Commands to refresh the data, start FlexDeploy, enable it to keep restarting as needed, and to check the status:

```
systemctl daemon-reload
systemctl start flexdeploy.service
systemctl enable flexdeploy.service
systemctl status flexdeploy.service
```
