LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-04-2018, 07:15 AM   #1
tankzeu
LQ Newbie
 
Registered: Sep 2018
Posts: 26

Rep: Reputation: Disabled
init.d script gets auto-enabled to systemd


I have installed new VM and put in /etc/init.d my test123.sh script which has LSB header and started it as a daemon service and of course the systemd doesn't recognize it via using systemctl status test123,however if I restart and type : systemctl status test123 ,it shows me active and the path to /etc/init.d .How did systemd recognize it?Shouldn't I first do systemctl enable test123.sh and then to expect to be recognized by the systemctl commands.I am using Linux Suse 12.2 . I seem to have in run/systemd/generator.late test123.service which I haven't put there.

Last edited by tankzeu; 10-04-2018 at 07:31 AM.
 
Old 10-04-2018, 07:50 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
systemd will automatically generate system unit files on the fly for init scripts when the system is started. This is why your script was recognized after the system was restarted and why test123.service file now exists. As far as I know systemd requires scripts to have the complete LSB header but it will try to determine priorities if incomplete or without them and may automatically enable your script.
 
Old 10-04-2018, 07:56 AM   #3
tankzeu
LQ Newbie
 
Registered: Sep 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
Does this happens for all distros and versions which have systemd ,or there are exceptions?
 
Old 10-04-2018, 08:08 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
I assume so. I don't know if any changes have been made to this functionality between systemd versions.
 
  


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
init.d script to systemd with systemd-sysv-generator tankzeu Linux - Newbie 1 09-17-2018 04:41 AM
LXer: The Story Behind ‘init’ and ‘systemd’: Why ‘init’ Needed to be Replaced with ‘systemd’ in Linu LXer Syndicated Linux News 1 04-07-2017 11:33 PM
LXer: systemd 230 Launches with DNSSEC Enabled by Default in systemd-resolved LXer Syndicated Linux News 0 05-22-2016 11:41 AM
Convert init script to systemd file service igor012 Linux - Software 1 10-15-2012 10:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:08 AM.

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