Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Init script after login screen
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
antonellocaroli
Guru
Guru


Joined: 11 Aug 2016
Posts: 510

PostPosted: Mon Sep 07, 2020 4:47 pm    Post subject: [Solved] Init script after login screen Reply with quote

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
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1549
Location: South America

PostPosted: Mon Sep 07, 2020 5:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3925
Location: Hamburg

PostPosted: Mon Sep 07, 2020 7:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Mon Sep 07, 2020 8:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
antonellocaroli
Guru
Guru


Joined: 11 Aug 2016
Posts: 510

PostPosted: Tue Sep 08, 2020 4:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
antonellocaroli
Guru
Guru


Joined: 11 Aug 2016
Posts: 510

PostPosted: Tue Sep 08, 2020 4:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum