LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 08-25-2021, 07:31 AM   #1
JuventusFC
LQ Newbie
 
Registered: Jul 2018
Posts: 15

Rep: Reputation: Disabled
Launch systemd service before login prompt


After being able to change the hostname on the fly, I am trying to run a systemd service before the login prompt, as the first time It asks for login credentials, the value printed on the screen refers to the previous content (previous startup) of /etc/hostname.

I already tried what is suggested here, but It didn't work for me

EDIT: It has some dependencies with other services as well, so launching the hostname-changing service as one of the first ones (i.e. DefaultDependencies=false) is not an option

Last edited by JuventusFC; 08-25-2021 at 08:32 AM.
 
Old 08-25-2021, 07:58 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Quote:
as the first time It asks for login credentials, the value printed on the screen refers to the previous content (previous startup) of /etc/hostname.
Not exactly sure what you are trying to accomplish. Without seeing your script anything you try to print or echo will not be displayed since the running script is not associated with the desktop or login manager.
However Depending on what desktop/login manager you are running it is possible to add a banner to the login screen.

Last edited by michaelk; 08-25-2021 at 08:05 AM.
 
Old 08-25-2021, 08:31 AM   #3
JuventusFC
LQ Newbie
 
Registered: Jul 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Not exactly sure what you are trying to accomplish. Without seeing your script anything you try to print or echo will not be displayed since the running script is not associated with the desktop or login manager.
However Depending on what desktop/login manager you are running it is possible to add a banner to the login screen.
The message would have to be shown on a CLI-only interface so It will be actually shown

Last edited by JuventusFC; 08-25-2021 at 08:36 AM.
 
Old 08-25-2021, 08:59 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
However, service start up messages are displayed but are cleared before the login prompt.

One way would be to have your script modify the contents of the /etc/issue file. /etc/issue is banner that is displayed before a user logins.

In the old days before systemd rc-local was a script that could run as the last step before login. Now you can create a similar feature using a service.
https://www.cyberciti.biz/faq/how-to...-linux-system/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stopping systemd service before stopping/unmountig s3fs fuse connection dr-ing Linux - Software 1 07-03-2021 02:19 AM
How to cache systemd-ask-password data for automatic systemd service restarts? midiox Linux - Server 0 09-02-2020 11:48 AM
Can't access full journalctl from script via systemd service even though user is in systemd-journal group iwtbf Linux - Newbie 0 02-19-2016 02:44 PM
Boot Delay 30min: systemd-analyze blame systemd-tmpfiles-setup.service BGHolmes Fedora 0 07-27-2011 09:02 AM
Text login prompt before XDM and before shutdown BuilderQ Linux - Software 1 11-24-2007 01:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration