Skip to content

Autostart DICOS API Gateway Manager with systemd

If you want to start DICOS API Gateway Manager as a systemd-service, e.g. for autostart, you can create a systemd-service definition like following:

  • Create a new file in /etc/systemd/system/ and call it 'aagm.service'.
    • vi /etc/systemd/system/aagm.service
  • Include the following input (assuming, that you have your docker-compose.yml file inside /opt/aagm): /etc/systemd/system/aagm.service
    [Unit]
    Description=Docker Compose container starter for DICOS API Gateway Manager
    After=docker.service network-online.target
    Requires=docker.service network-online.target
    [Service]
    WorkingDirectory=/opt/aagm
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/local/bin/docker-compose up -d
    ExecStop=/usr/local/bin/docker-compose down
    ExecReload=/usr/local/bin/docker-compose pull --quiet --parallel
    ExecReload=/usr/local/bin/docker-compose up -d
    [Install]
    WantedBy=multi-user.target
    

Now you can use the following commands to manage your DICOS API Gateway instance:

# Start DICOS API Gateway Manager
systemctl start aagm.service

# Stop DICOS API Gateway Manager
systemctl stop aagm.service

# Restart DICOS API Gateway Manager
systemclt restart aagm.service

# Enable autostart for DICOS API Gateway Manager
systemctl enable aagm.service

# Disable autostart for DICOS API Gateway Manager
systemctl disable aagm.service