Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to make Linux execute a line of commands startup

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
saeson
Posts: 5
Joined: 2019-12-20 12:34

How to make Linux execute a line of commands startup

#1 Post by saeson »

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.

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

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

#2 Post by L_V »

Just create /etc/rc.local file , and then:

Code: Select all

chmod +x /etc/rc.local
systemctl enable rc.service
systemctl status rc.service

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

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

#3 Post by saeson »

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 ?

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

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

#4 Post by L_V »

Code: Select all

systemctl unmask rc.service

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

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

#5 Post by saeson »

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

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

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

#6 Post by L_V »

This one ?

Code: Select all

systemctl unmask rcS.service

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

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

#7 Post by saeson »

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

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

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

#8 Post by L_V »

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...

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

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

#9 Post by saeson »

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,

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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

#10 Post by Head_on_a_Stick »

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
deadbang

Post Reply