2

I want to add a service to my Artix linux system, which is a Arch Linux drivate with OpenRC as init system.

Consider the systemd service

[Unit]
Description=sets battery thresholds

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/tpacpi-bat -s ST 0 40
ExecStart=/usr/bin/tpacpi-bat -s SP 0 80
ExecStop=/usr/bin/tpacpi-bat -s ST 0 0
ExecStop=/usr/bin/tpacpi-bat -s SP 0 0

[Install]
WantedBy=multi-user.target

how do I convert this into openrc and should it placed so that can add it via rc-service {service-name} start?

3 Answers 3

2

Recently, a dedicated online service has been set up for converting systemd service files to OpenRC init scripts: http://openrc.run/

1
% cat systemd.service
[Unit]
Description=sets battery thresholds
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/tpacpi-bat -s ST 0 40
ExecStart=/usr/bin/tpacpi-bat -s SP 0 80
ExecStop=/usr/bin/tpacpi-bat -s ST 0 0
ExecStop=/usr/bin/tpacpi-bat -s SP 0 0    
[Install]
WantedBy=multi-user.target

% initify.pl systemd.service

% cat systemd
#!/sbin/openrc-run
command=/usr/bin/tpacpi-bat
command_args="-s ST 0 40"
pidfile=
name="systemd"
description="sets battery thresholds"

The shebang is for Gentoo; in Artix it needs to be #!/usr/bin/openrc-run.

1
0

There's a user-contributed script that does basic systemd.service to openrc initscript conversion: https://forum.artixlinux.org/index.php/topic,276.0.html

1
  • Can you elaborate on this a little more?
    – Toto
    Commented Jul 21, 2018 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .