View previous topic :: View next topic |
Author |
Message |
antonellocaroli Guru
Joined: 11 Aug 2016 Posts: 510
|
Posted: Mon Sep 07, 2020 4:47 pm Post subject: [Solved] Init script after login screen |
|
|
I have a problem with one of my init scripts in the default runvel.
The system is a system without a graphical interface.
The init script starts after local.
Inside the inti script there are a series of sleeps, the problem is that until the init script finishes the sleeps the system doesn't get to the login screen.
Isn't there a way to start the script after the login screen?
no after login, but after the login screen.
Last edited by antonellocaroli on Tue Sep 08, 2020 4:05 pm; edited 1 time in total |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1549 Location: South America
|
Posted: Mon Sep 07, 2020 5:37 pm Post subject: |
|
|
The problem is, the processes that make the login screen appear (agetty) are controlled by sysvinit, not by OpenRC. And the line in /etc/inittab that makes OpenRC enter the default runlevel has a wait action, and comes before the agetty lines, for good reasons: in general, you want OpenRC to complete the boot process before you can log in.
It should be possible to have sysvinit run a script after OpenRC has started all services in the default runlevel, and in parallel with the agetty processes, but you configure that with a line in /etc/inittab, using the once action. I never tried that, though. |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3925 Location: Hamburg
|
Posted: Mon Sep 07, 2020 7:32 pm Post subject: |
|
|
Does something like this in your /etc/local.d/99_foo.start script helps?
Code: | #/bin/bash
#
(
cmd1
sleep 23
cmd2
sleep 42
..
) & |
|
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Mon Sep 07, 2020 8:07 pm Post subject: |
|
|
I do this on a couple machines. Not sure if this technique suits your purpose. Would work even if not an autologin.
Code: | # /etc/bash/bashrc.d/tty6-startup
# /etc/inittab has an autologin on tty6
# After starting bash, but only on that specific tty, run screen
[ `tty` = /dev/tty6 ] && screen |
|
|
Back to top |
|
|
antonellocaroli Guru
Joined: 11 Aug 2016 Posts: 510
|
Posted: Tue Sep 08, 2020 4:05 pm Post subject: |
|
|
toralf wrote: | Does something like this in your /etc/local.d/99_foo.start script helps?
Code: | #/bin/bash
#
(
cmd1
sleep 23
cmd2
sleep 42
..
) & |
|
Thank you!!!
This seems to work well!!! |
|
Back to top |
|
|
antonellocaroli Guru
Joined: 11 Aug 2016 Posts: 510
|
Posted: Tue Sep 08, 2020 4:48 pm Post subject: |
|
|
It also seems to work by inserting it into an init script.
type:
Quote: | #!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
user="root:root"
depend() {
use alsasound
after local
}
_mystart() {
(
sleep 4
start1
sleep 6
start2
) &
}
start() {
ebegin "Starting ${SVCNAME}"
_mystart[/code]
eend $?
}
|
|
|
Back to top |
|
|
|