[systemd-devel] vgetty under systemd
Koen Kooi
koen at dominion.thruhere.net
Sun Jul 17 12:03:45 PDT 2011
Op 17 jul 2011, om 19:45 heeft Ryan Nelson het volgende geschreven:
> On 7/16/2011 1:20 PM, Lennart Poettering wrote:
>> On Sat, 16.07.11 10:43, Ryan Nelson (ryan.freedesktop at rnelnet.com) wrote:
>>
>>>
>>> Ok, so I read more on systemd (and the man page for inittab) and
>>> came up with a basic vgetty.service that I'm using with systemd.
>>> After doing little ready its pretty easy.
>>>
>>> So I wanted to ask if I can make my service file better than this:
>>>
>>> --snip /lib/systemd/system/vgetty.service--
>>> # This file is part of systemd.
>>> #
>>> # systemd is free software; you can redistribute it and/or modify it
>>> # under the terms of the GNU General Public License as published by
>>> # the Free Software Foundation; either version 2 of the License, or
>>> # (at your option) any later version.
>> This file isn't really part of systemd, is it? So the header can go...
>
> Changed
>
>>
>>> [Unit]
>>> Description=Program to answer voice calls using Vgetty
>>> After=syslog.target
>>>
>>> [Service]
>>> ExecStart=-/sbin/vgetty /dev/ttyS2
>>> Restart=always
>>> RestartSec=0
>>> KillMode=process
>> Why KillMode=process?
>
> It was part of the example, it should work as you only need to kill vgetty but control-group would work too, removed the KillMode option.
>
>>
>>> [Install]
>>> WantedBy=multi-user.target
>> As mentioned in my other response: consider making this a template you
>> can easily enable for multiple ports by symlinking it to
>> vgett at ttyS0.service, vgetty at ttyS1.service and so on.
>
> Right, but then how many do you include. So I took at look at the getty on and it has "BindTo=dev-%i.device" where does %i come from. Can I use this in a vgetty.service implementation so I don't have to specify the device?
The %i is the filename bit between the '@' and '.service'. So if you have a vgetty at ttyMYNAME1.service $i will resolve to ttyMYNAME1, provides there is a udev rule tagging it with 'systemd', which there is for serial ports by default.
regards,
Koen
More information about the systemd-devel
mailing list