Sample Header Ad - 728x90

Correct way to edit /etc/init.d entries

0 votes
0 answers
142 views
At some point in the lifetime of my present Devuan (stable) installation, I edited an entry in /etc/init.d, in this specific case, /etc/init.d/halt. This may have been as early as Jesse or Beowulf, dist upgraded now to Daedalus via Chimaera. It has been a good while so I cannot recall but I may have used jed (my usual), nano or the mc editor. The thing is that, as a result, I ended up with two entries:
/etc/init.d/halt
/etc/init.d/halt~
At that time and thinking that the newly generated entry (obviously a backup) would just stay there, I left it at that. ie: by *stay there* I mean oblivious as to what was going on within the system and *not* taken into account.
~$ ls -1 /etc/init.d
--- snip ---
halt
--- snip ---
halt~
--- snip ---
~$
While I have a look at my log files every fortnight or so to see if I catch anything strange, I don't do the same with running services unless it is warranted. eg: something seems to be amiss or the latest CUPS/cups-browsed CVE thing which had everyone scrambling. So I had a look at and, to my surprise, found this:
~$ sudo service --status-all
--- snip ---
 [ - ]  halt~     <- this is the *backup* file being loaded.
--- snip ---
~$
As I have explained, both files are present in /etc/init.d and have the same attributes. They also have the same size because, for testing purposes, I have edited the original file to reflect the contents of the backup file.
~$ ls -l /etc/init.d/halt
-rwxr-xr-x 1 root root 1417 Sep 29 08:01 /etc/init.d/halt
~$
~$ ls -l /etc/init.d/halt~
-rwxr-xr-x 1 root root 1417 Sep 28 07:56 /etc/init.d/halt~
~$
Can anyone tell me *why* the backup file is being loaded instead of the edited file? ie: /etc/init.d/halt~ instead of /etc/init.d/halt. What have I missed / done the *wrong* way? Where should I be looking?
Asked by Groucho (31 rep)
Oct 1, 2024, 11:47 AM
Last activity: Oct 1, 2024, 01:26 PM