Hello,
Of course. Modern versions of Ubuntu use systemd, with which you can
drop a "service" file[1] in /etc/systemd/system (e.g. orthanc.service).
Example[2]:
[Unit]
Description=Foo
[Service]
ExecStart=/usr/sbin/foo-daemon
[Install]
WantedBy=multi-user.target
After that, all the usual controls work:
systemctl enable orthanc
(This enables it to start automatically when the system boots up.)
systemctl start orthanc
(This starts it immediately.)
systemctl status
journalctl --unit=orthanc
(Status and logs.)
Note: It's a shame these service files are not already packaged in
either Debian or Ubuntu. I think it is fair to open an issue on their
trackers[3][4] for that if anyone is willing to push for it.
Note: It seems the Debian and Ubuntu packages contain an old init
script (for sysv init) though I'm not sure about the state of chkconfig
or any systemd facilities for legacy init scripts (you might not be
able to have it start automatically in that way anymore).
Fedora does package a service file[5] which I copy here, I think you
might be able to safely reuse it in Ubuntu (i.e. write this in
/etc/systemd/system/orthanc.service).
[Unit]
Description=Orthanc DICOM server
Documentation=man:Orthanc(1)
http://www.orthanc-server.com/
After=syslog.target network.target
[Service]
Type=simple
User=orthanc
Group=orthanc
ExecStart=/usr/sbin/Orthanc /etc/orthanc/
[Install]
WantedBy=multi-user.target
Important: This assumes you have a user called "orthanc" on the system
and that this user has full access to the Orthanc storage directory. I
think this is all the case on Ubuntu if you install the orthanc
package:
root@bd633d075965:/# (. /etc/os-release && echo $VERSION_CODENAME)
xenial
root@bd633d075965:/# apt list orthanc
Listing... Done
orthanc/xenial,now 1.0.0+dfsg-1build1 amd64 [installed]
root@bd633d075965:/# dpkg --listfiles orthanc | grep /etc
/etc
/etc/orthanc
/etc/orthanc/worklists.json
/etc/orthanc/orthanc.json
/etc/orthanc/serve-folders.json
/etc/init.d
/etc/init.d/orthanc
root@bd633d075965:/# grep --extended-regex '"(Storage|Index)Directory"'
/etc/orthanc/orthanc.json
"StorageDirectory" : "/var/lib/orthanc/db-v6",
"IndexDirectory" : "/var/lib/orthanc/db-v6",
root@bd633d075965:/# service orthanc start
root@bd633d075965:/# getent passwd orthanc
orthanc:x:106:107:Orthanc Administrator,,,:/var/lib/orthanc:/bin/bash
root@bd633d075965:/# stat --format=%U /var/lib/orthanc/db-v6
orthanc
So, it should work as-is.
[1]
https://www.freedesktop.org/software/systemd/man/systemd.service.ht
ml
[2]
https://www.freedesktop.org/software/systemd/man/systemd.service.ht
ml#Examples
[3]
https://launchpad.net/ubuntu/+source/orthanc/+bugs
[4]
https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=orthanc;dist=unst
able
[5]
https://apps.fedoraproject.org/packages/orthanc
--
Thibault Nélis <
t...@osimis.io>
Osimis