Koozali.org: home of the SME Server

Adding custom systemd units to SME

Offline mauro

  • ***
  • 101
  • +0/-0
Adding custom systemd units to SME
« on: August 02, 2021, 10:50:44 AM »
I have two systemd units and I want to make SME10 aware of them.
It's a service and the relative timer, i.e. myunit.service and myunit.timer .
I understand I need to create a db entry like
Code: [Select]
db configuration set myunit service status enabledbut what's the correct syntax for the timer?
All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer.
-- IBM maintenance manual (1975)

Offline ReetP

  • *
  • 3,736
  • +5/-0
Re: Adding custom systemd units to SME
« Reply #1 on: August 02, 2021, 11:03:36 AM »
You'll need Jean Philippe to answer this.

It is not as simple as just adding a config key.

Some of it is documented but I think more is required.

Start here, and check locally for presets etc to compare.

https://wiki.koozali.org/SME10_serviceControl

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Adding custom systemd units to SME
« Reply #2 on: August 02, 2021, 01:02:04 PM »
timer are not supported, nor socket… only dot service files

please rather use cron, or you are on your own to have it working.

you need to create the entry in config db as you mentioned and you need to make it   WantedBy= sme-server.target.
To do that you need to create a folder /etc/systemd/system/servicename.service.d
and add a file in it 51custom.conf with content:
[Install]
WantedBy= sme-server.target

if you were to do a contrib you would create the dot d  folder in /usr/lib/systemd/system

Offline mauro

  • ***
  • 101
  • +0/-0
Re: Adding custom systemd units to SME
« Reply #3 on: August 03, 2021, 10:16:36 AM »
Thank you, i'll revert to the good old cron.
All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer.
-- IBM maintenance manual (1975)