Project

General

Profile

Simple SystemD service file / init script

Added by Ben Erridge over 12 years ago

I thought I would post this in case anyone needed it. Took Me a little digging to figure out systemd files.
FYI: I am no expert at this so use at your own risk

Create a file called redmine.service in /usr/lib/systemd/system/ (for fedora) copy the text below into the new file.

[Unit]
Description=Redmine server
After=syslog.target
After=network.target

[Service]
Type=simple
User=<redmine user>
Group=<redmine group>
ExecStart=/bin/ruby <redmine home>/script/rails server webrick -e production

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

[Install]
WantedBy=multi-user.target

Change <redmine user> to be the user you want redmine to run as
Change <redmine group> to be the group you want redmine to run as
Change <redmine home> to be the absolute locate to your redmine directory
Save the file

to install this service use (as root or sudo)
systemctl enable redmine.service

to start the service use (as root or sudo)
systemctl start redmine.service

Logs will be written to /var/log/messages


Replies (4)

RE: Simple SystemD service file / init script - Added by Hung Nguyen Vu over 12 years ago

systemd is available on Fedora (as you said) but I am not sure how popular it is on other Linux distros and Unix-based OSes.

Making a shell script for starting webrick, put that file into init 3 or init 5 folder should be easier and portable.

Cf. http://www.yolinux.com/TUTORIALS/LinuxTutorialInitProcess.html

RE: Simple SystemD service file / init script - Added by Ben Erridge about 12 years ago

Yes, systemd is not likely to be supported on Non-Linux based Unix systems in the near future. However most major distributions are moving to systemd as it has some major advantages over SysV init and Upstart.

We are not going to be moving off Linux anytime soon. Also this is far simpler than any proper sysv init script I have ever written and I have written many.

RE: Simple SystemD service file / init script - Added by Jan Niggemann (redmine.org team member) about 12 years ago

Vu Hung Nguyen wrote:

systemd is available on Fedora (as you said) but I am not sure how popular it is on other Linux distros and Unix-based OSes.

Systemd is highly controversial:
Fedora - used upstart and is now using systemd
RHEL - will probably start using systemd with RHEL 7
Ubuntu - uses upstart
Arch - will soon use systemd
Debian - doesn't like systemd and will stick to sysvinit
OpenSuse - remdumped systemd because of incompatibilities but wants to re-integrate it
...

    (1-4/4)