How to make Linux execute a line of commands startup

New to Debian (Or Linux in general)? Ask your questions here!

How to make Linux execute a line of commands startup

Postby saeson » 2019-12-20 12:38

I tried to find rc.local, but I didn't find it in / etc directory, nor init. D and RC. D. what should I do? I installed debian10 standard in PVE
Last edited by saeson on 2019-12-20 16:18, edited 1 time in total.
saeson
 
Posts: 5
Joined: 2019-12-20 12:34

Re: How to make Linux execute a line of commands automatical

Postby L_V » 2019-12-20 12:53

Just create /etc/rc.local file , and then:
Code: Select all
chmod +x /etc/rc.local
systemctl enable rc.service
systemctl status rc.service
L_V
 
Posts: 1270
Joined: 2007-03-19 09:04

Re: How to make Linux execute a line of commands automatical

Postby saeson » 2019-12-20 13:06

L_V wrote:Just create /etc/rc.local file , and then:
Code: Select all
chmod +x /etc/rc.local
systemctl enable rc.service
systemctl status rc.service



root@qbte1:~# systemctl enable rc.service
Failed to enable unit: Unit file /lib/systemd/system/rc.service is masked.

root@qbte1:~# systemctl status rc.service
● rc.service
Loaded: masked (Reason: Unit rc.service is masked.)
Active: inactive (dead)


Is there something missing ?
saeson
 
Posts: 5
Joined: 2019-12-20 12:34

Re: How to make Linux execute a line of commands automatical

Postby L_V » 2019-12-20 13:09

Code: Select all
systemctl unmask rc.service
L_V
 
Posts: 1270
Joined: 2007-03-19 09:04

Re: How to make Linux execute a line of commands automatical

Postby saeson » 2019-12-20 13:58

L_V wrote:
Code: Select all
systemctl unmask rc.service


root@qbte1:~# systemctl unmask rc.service
root@qbte1:~# systemctl status rc.service
● rc.service
Loaded: masked (Reason: Unit rc.service is masked.)
Active: inactive (dead)

It doesn't seem to work
saeson
 
Posts: 5
Joined: 2019-12-20 12:34

Re: How to make Linux execute a line of commands automatical

Postby L_V » 2019-12-20 14:06

This one ?
Code: Select all
systemctl unmask rcS.service
L_V
 
Posts: 1270
Joined: 2007-03-19 09:04

Re: How to make Linux execute a line of commands automatical

Postby saeson » 2019-12-20 14:12

L_V wrote:This one ?
Code: Select all
systemctl unmask rcS.service


root@qbte1:~# systemctl status rcS.service
● rcS.service
Loaded: masked (Reason: Unit rcS.service is masked.)
Active: inactive (dead)
root@qbte1:~#

same problem
saeson
 
Posts: 5
Joined: 2019-12-20 12:34

Re: How to make Linux execute a line of commands automatical

Postby L_V » 2019-12-20 14:49

I've used rc.local some time ago.
I don't know why now unmasking would not work, and did not remember any specific difficulty.
No more idea...
L_V
 
Posts: 1270
Joined: 2007-03-19 09:04

Re: How to make Linux execute a line of commands automatical

Postby saeson » 2019-12-20 16:17

L_V wrote:I've used rc.local some time ago.
I don't know why now unmasking would not work, and did not remember any specific difficulty.
No more idea...


Thank you. I'll try again,
saeson
 
Posts: 5
Joined: 2019-12-20 12:34

Re: How to make Linux execute a line of commands startup

Postby Head_on_a_Stick » 2019-12-20 16:27

Debian buster should now auto-run rc-local.service if /etc/rc.local exists and is executable: https://manpages.debian.org/buster/syst ... .8.en.html

@OP: please post the output of
Code: Select all
ls -lR /etc/systemd/system

Masked services will be symlinked to /dev/null, you could try deleting the symlink manually if there are any for rc-local.service.

EDIT: my buster box has rc.service (and rcS.service) masked by default:
Code: Select all
-rw-r--r-- 1 root root  716 Oct 16 14:24 rc-local.service
lrwxrwxrwx 1 root root   16 Oct 16 14:24 rc.local.service -> rc-local.service
drwxr-xr-x 1 root root   22 Nov 16 10:39 rc-local.service.d
lrwxrwxrwx 1 root root    9 Oct 16 14:24 rc.service -> /dev/null
lrwxrwxrwx 1 root root    9 Oct 16 14:24 rcS.service -> /dev/null
User avatar
Head_on_a_Stick
 
Posts: 11952
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable