I have installed osrm on my server in home/myname/osrmif 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.targetBut 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-routedi 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 strippedi 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.targetNow, 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 Enterthis starts the process - the process is a server, waiting on localhost:port5000 for queries like
geometries=geojsonand 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
21 Answer
I see several issues here:
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/usr/local/bin/osrm-routedappears to be a directory not anexecutablefile.- Run
file /usr/local/bin/osrm-routedto determine for sure but I think you can know that by merely changing into it.
- Run
Note: Don't know what type of program your trying to run so
Typeoption could beType=[simple|daemon|oneshot|forking|notify|idle]
More information: