[systemd-devel] autostart processes based on tty
Emanuel Berg
embe8573 at student.uu.se
Mon May 16 02:09:52 UTC 2016
I would like to start different processes in
different ttys on boot, automatically and with
autologin first, and then have them run as normal
programs, with the I/O intact, including quitting
and get the shell - i.e., just as you would if you
did it all manually. (The autologin part of the
above question I solved.)
Up and until today, I've done this with zsh in
.zprofile, and I include it here so you'll know
exactly what I ask for:
# ...
local tty_number=${TTY#/dev/tty}
case $tty_number in
(1) lkeys # [1]
make -C ~/.emacs.d/emacs-init
emacs ;;
(2|3) tmux-new-session-split ;;
(5) echo "Waiting for Internet connection..."
when-internet-set-time > /dev/null # ~/.zsh/web
tmux ;;
(6) start-x-if-not-running & ;;
esac
# ...
I thought it'd be a good idea to do it with systemd!
As a test, I tried to do it with top(1) in
/dev/tty4, and I got this far
[Unit]
Description=top on tty4
[Service]
Type=simple
ExecStart=/usr/bin/top
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty4
Restart=always
[Install]
WantedBy=getty.target
This results in a running process, but it doesn't
seem to be associated with /dev/tty4 and there is no
I/O there but the familiar shell.
PS. I would say this is a ".user" question but
I couldn't find such a group!
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 30 Blogomatic articles -
More information about the systemd-devel
mailing list