starting a service in Ubuntu 16.04:

I have created a systemd unit file named

/usr/lib/systemd/system/icrypts-core-prices-update.service

with this content:

[Unit]
Description=iCrypts Core Prices Update Daemon
After=network.target

[Service]
Environment="APPCP=/opt/icrypts/icrypts-core-price-update" Environment="JAVAHOME=/usr/java/latest"
Environment="APPNAME=icrypts-core-prices-update-0.0.1-SNAPSHOT.jar" Environment="LOGPATH=/home/icrypts/logs/icrypts/icrypts-core-price-update" ExecStartPre=/bin/mkdir -pm 0755 ${LOGPATH} ExecStart=/bin/bash -c "$JAVAHOME/bin/java -jar ${APP_NAME}"
PIDFile=/run/icrypts/icrypts-core-price-update%i.pid
Restart=on-abort
RuntimeDirectory=icrypts-core-price-update
RuntimeDirectoryMode=755
WorkingDirectory=/opt/icrypts/icrypts-core-price-update

[Install]
WantedBy=multi-user.target

I start the service using:

sudo systemctl enable --now icrypts-core-prices-update

But when I check the status I got this error:

systemctl status icrypts-core-prices-update.service
● icrypts-core-prices-update.service - iCrypts Core Prices Update Daemon
Loaded: loaded (/usr/lib/systemd/system/icrypts-core-prices-update.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-07-21 06:17:43 UTC; 1 day 2h ago

and

sudo journalctl -u icrypts-core-price-update.service
-- No entries --

2 Replies

Linode Staff

It can be difficult to determine exactly which part of your custom systemd service is causing the failure you are experiencing.

We offer a guide on our Guides & Tutorials page with instructions on creating a custom systemd service. You can find that guide at the following link:

How to Create a new service with systemd

I would also recommend taking a look at the following guide, which is specific to Ubuntu, that offers details on setting up systemd services.

Use systemd to Start a Linux Service at Boot

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct