LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adding files to /etc/init.d (https://www.linuxquestions.org/questions/linux-newbie-8/adding-files-to-etc-init-d-4175604760/)

NotionCommotion 04-27-2017 09:44 AM

Adding files to /etc/init.d
 
Startup scripts can be added to /etc/init.d/.

I see some with a .sh extension, and others with no extension.

Does it matter? If so, why one over the other? If not, which is considered more proper?

Also, update-rc.d allows me to add and remove them to init. Is there a way to display those which have been added, or should I just use ls /etc/rc*.d?

Thanks

PS. Relates to a Raspberry Pi

smallpond 04-27-2017 09:54 AM

Extensions are a human-readable mnemonic. Code should never depend on the presence or absence of an extension. It makes gzip a pain to use. Use chkconfig --list to show the configuration of files in /etc/init.d/

NotionCommotion 04-27-2017 10:00 AM

Is the best practice not to use them, or to use them, or to use them just when you want to make it more obvious to a human?

Also, chkconfig doesn't exist. I started with Centos which I did use, but with debian, I thought update-rc was the tool.

wpeckham 04-27-2017 10:30 AM

Quote:

Originally Posted by NotionCommotion (Post 5702963)
Is the best practice not to use them, or to use them, or to use them just when you want to make it more obvious to a human?

Also, chkconfig doesn't exist. I started with Centos which I did use, but with debian, I thought update-rc was the tool.

init.d is one of the "special" folders that should only hold one type of file (a script) or a link to that kind of file. Nothing in that folder should require an extension, but I would not obsess over it one way or another.

chkconfig is somewhat specific to the Red Hat family of distributions. Moving between a dozen distributions, I use the tools, but often look for myself. That is easy on a system that uses the traditional tools, but I have not fully adjusted to the systemd world just yet and still need the tools on those.

r3sistance 04-27-2017 10:39 AM

what version of debian are you using? if it is an up-to-date version then it will be using systemd rather than sysvinit which maybe a consideration on how to implement things.

NotionCommotion 04-27-2017 11:00 AM

Quote:

Originally Posted by r3sistance (Post 5702976)
what version of debian are you using? if it is an up-to-date version then it will be using systemd rather than sysvinit which maybe a consideration on how to implement things.

Raspbian Jessie which is a debian derivative.

grail 04-27-2017 11:45 AM

Not sure where that version sits in the scheme of things. According to distrowatch the latest version (2017-04-10) is using systemd, so you would be looking to run systemctl --list-units.
The previous listed version (2015-02-16) is still sysvinit. Of course if it is anything like Oracle linux, they decided to mix the 2 together (sheesh)


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