Project

General

Profile

Actions

Feature #5350

closed

redux systemd service

Added by Anchi Cheng almost 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
12/06/2017
Due date:
% Done:

0%

Estimated time:
Deliverable:

Description

This provides service that works on CentOS7 and above and other OS such as Ubuntu.

Actions #1

Updated by Patrick Goetz almost 6 years ago

I just noticed this task was assigned to me. I think I've already provided an answer in the forum, but here is a very simple systemd unit file which works for Ubuntu systems:

/etc/systemd/system/reduxd.service:

[Unit]
Description=Redux Image Server
After=apache2.service

[Service]
Type=simple
User=root
Group=root
PrivateTmp=true
WorkingDirectory=/usr/local/bin
ExecStart=/usr/local/bin/reduxd

[Install]
WantedBy=multi-user.target

A similar unit file (not tested) should work for CentOS systems. The only difference is that the Apache httpd service is called httpd.service on CentOS systems, so the presumed service file would be this:

/etc/systemd/system/reduxd.service:

[Unit]
Description=Redux Image Server
After=httpd.service

[Service]
Type=simple
User=root
Group=root
PrivateTmp=true
WorkingDirectory=/usr/local/bin
ExecStart=/usr/local/bin/reduxd

[Install]
WantedBy=multi-user.target

Any other changes (say running the service as something other than root, for example) should be self-explanatory. However, systemd allows for a lot of interesting features. For example, to have the reduxd server restart automatically whenever it crashes or is killed, one can modify the service file like this:

/etc/systemd/system/reduxd.service:

[Unit]
Description=Redux Image Server
After=httpd.service

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
Group=root
PrivateTmp=true
WorkingDirectory=/usr/local/bin
ExecStart=/usr/local/bin/reduxd

[Install]
WantedBy=multi-user.target

The Restartsec field specifies that the service should sleep for one second before restarting.

Actions #2

Updated by Anchi Cheng almost 6 years ago

  • Status changed from Assigned to Closed

Thanks.

Actions

Also available in: Atom PDF