1

I have installed osrm on my server in home/myname/osrm if I manually start the process from beyond dir with osrm-routed data/map.osrm it works fine, but unfortunately in foreground and after reboot if have to start it manually again. I tried to install it as a service

[Unit]
Description = starts up the osrm service
After = network.target
[Service]
WorkingDirectory=/home/christian/osrm/
User=christian
ExecStart = /usr/local/bin/osrm-routed   osrm-routed data/map.osrm
[Install]
WantedBy = multi-user.target

But when I start the service I get always error messages like this

 [/etc/systemd/system/osrmstart.service:7] Executable path specifies a directory, ignoring: /usr/local/bin/osrm-routed/ osrm-routed data/map.osrm
Sep 01 14:03:46 ubuntu systemd[1]: osrmstart.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.

What are I am doing wrong. I am very new to Ubuntu.


Thank you for answering to my question:

when i run:

file /usr/local/bin/osrm-routed

i get the following:

/usr/local/bin/osrm-routed: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=767f57fe712d25f03f1b2d18fd541d0253cd86d4, not stripped

i changed my osrmstart.service to:

[Unit]
Description = starts up the osrm service
After = network.target
[Service]
Type=simple
WorkingDirectory=/home/christian/osrm/
User=christian
ExecStart = /usr/local/bin/osrm-routed   osrm-routed data/map.osrm
[Install]
WantedBy = multi-user.target

Now, if i first disable, then enable the osrmstart.service and then start the service with sudo systemctl start osrmstart.service: I get no error - but the service is not starting and is not available.

Manually i can start the process when i navigate to my home dir ~/home/osrm and then typing osrm-routed data/map.osrm and Enter this starts the process - the process is a server, waiting on localhost:port5000 for queries like

http://192.168.1.200:5000/route/v1/driving/11.57787,48.13877;11.52045,48.13969?steps=true&alternatives=true&
geometries=geojson

and returns the way from target to destination,but manually the process is running in forground.

I need the service running in background, also when rebooting the system. Maybe its only a type error - but i tried so many kinds of typings. Maybe my answer helps a bit more, for helping me. Thanks in advance.

Christian

2
  • Like I said your code has syntax errors, please check the links I gave! Sep 1, 2017 at 15:46
  • 1
    Now run which osrm-routed I suppose you will get /usr/local/bin/osrm-routed hence that will be the command to use in the systemd service file. And please remove the unnecessary spaces in your code! Sep 1, 2017 at 15:57

1 Answer 1

2

I see several issues here:

  1. Code syntax errors your code should look like this:

    [Unit]
    Description=starts up the osrm service
    After=network.target
    
    [Service]
    Type=daemon
    WorkingDirectory=/home/christian/osrm/
    User=christian
    ExecStart=/usr/local/bin/osrm-routed data/map.osrm
    
    [Install]
    WantedBy=multi-user.target
    
  2. /usr/local/bin/osrm-routed appears to be a directory not an executable file.

    • Run file /usr/local/bin/osrm-routed to determine for sure but I think you can know that by merely changing into it.
  3. Note: Don't know what type of program your trying to run so Type option could be Type=[simple|daemon|oneshot|forking|notify|idle]

More information:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html

https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .