Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #228126 > unrolled thread

kbrequest & openvt

Started bymike.junk.46@att.net
First post2020-10-23 00:50 +0200
Last post2020-10-23 14:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.debian.user

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  kbrequest & openvt mike.junk.46@att.net - 2020-10-23 00:50 +0200
    Re: kbrequest & openvt Greg Wooledge <wooledg@eeg.ccf.org> - 2020-10-23 14:00 +0200

#228126 — kbrequest & openvt

Frommike.junk.46@att.net
Date2020-10-23 00:50 +0200
Subjectkbrequest & openvt
Message-ID<B2Rzb-84h-5@gated-at.bofh.it>
This is a command line related question, not X.

For years under sysvinit, in /etc/inittab, this line:
kb::kbrequest:$( [ "`id -u`" -eq 0 ] && /bin/openvt -su || sudo /bin/openvt -su)
allowed me to open another VT by keying Control-UpArrow.

I've had no luck generating that same functionality under systemd.
If anyone else has managed to do this I'd sure appreciate a primer.

Actually if there is another way to achieve the same results I'll gladly put kbrequest aside.

Thanks,
Mike

[toc] | [next] | [standalone]


#228138

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2020-10-23 14:00 +0200
Message-ID<B33TH-71h-7@gated-at.bofh.it>
In reply to#228126
On Thu, Oct 22, 2020 at 10:30:17PM +0000, mike.junk.46@att.net wrote:
> For years under sysvinit, in /etc/inittab, this line:
> kb::kbrequest:$( [ "`id -u`" -eq 0 ] && /bin/openvt -su || sudo /bin/openvt -su)
> allowed me to open another VT by keying Control-UpArrow.

What a cargo-culted mess.  Mixing both forms of command substitution
syntax is sure sign that someone "borrowed" some code that they don't
understand, and then banged on it with a rock until it appeared to
work some of the time.

Why do you even need a check for the user ID of a program spawned by
init?  It's always root.

> I've had no luck generating that same functionality under systemd.
> If anyone else has managed to do this I'd sure appreciate a primer.

So, I searched google for "systemd equivalent kbrequest", and
it gave me <https://www.freedesktop.org/software/systemd/man/systemd.html>.

It has a section about a unit named kbrequest.target, under the
heading of SIGWINCH (very comparable to what the init/inittab man pages
show).

So, I would imagine what you want to do is place your command in a
customized kbrequest.target unit, which you would create under /etc.
And skip all that dumb ID-checking shell wrapper code, because it
always runs as root anyway.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web