Orthanc at startup

2,185 views
Skip to first unread message

supertr...@gmail.com

unread,
Nov 7, 2017, 2:27:57 AM11/7/17
to Orthanc Users
I installed Orthanc on a Ubuntu server. The only disadvantage, give the "Orthanc ./Configuration.json" command at each startup.

It's possibile start the service automatically on boot?

Thibault Nélis

unread,
Nov 7, 2017, 5:13:00 AM11/7/17
to orthan...@googlegroups.com
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

supertr...@gmail.com

unread,
Nov 7, 2017, 5:46:56 AM11/7/17
to Orthanc Users
Ubuntu automatically start orthanc service, but without my configuration (for example different port, user and password).
Every time that i boot server, i have to stop orthanc default service and then start orthanc with my configuration

Thibault Nélis

unread,
Nov 7, 2017, 8:11:55 AM11/7/17
to orthan...@googlegroups.com
On Tue, 2017-11-07 at 02:46 -0800, supertr...@gmail.com wrote:
> Ubuntu automatically start orthanc service, but without my
> configuration (for example different port, user and password).
> Every time that i boot server, i have to stop orthanc default service
> and then start orthanc with my configuration

It's likely starting it by pointing Orthanc to /etc/orthanc for
configuration with its first argument (you can check
/etc/init.d/orthanc).

I would advise you modify configuration in /etc/orthanc (you can even
remove all files there and replace them with your own; do keep a backup
just in case).

Otherwise you can modify /etc/init.d/orthanc to point to another
configuration file or directory. I would advise against it however,
prefer setting up a service file specific to your machine (or one that
just overrides the command-line with `systemctl edit`).

Sébastien Jodogne

unread,
Nov 8, 2017, 3:06:20 AM11/8/17
to Orthanc Users
I confirm Thibault's answer. If you use the official Debian/Ubuntu packages for Orthanc:
  • Orthanc is automatically started at boot time (default DICOM port is 4242, default HTTP port is 8042).
  • The configuration files for Orthanc and its plugins are located in "/etc/orthanc/".
  • Type "sudo /etc/init.d/orthanc restart" to take new parameters into consideration after modifying the configuration files.
Regards,
Sébastien-
Reply all
Reply to author
Forward
0 new messages