Artix Linux Forum

Artix Linux => Applications & Software => Topic started by: AntonyZ0 on 09 March 2023, 18:41:33

Title: [SOLVED] How to autorun at boot a non runit daemon
Post by: AntonyZ0 on 09 March 2023, 18:41:33
Hello, I need to add two commands at boot, but root permissions are needed.
I have the /usr/bin/vpn-unlimited-daemon and the /usr/bin/preload. In which way can I add them at boot? My desktop environment is plasma, and the init service is runit.
Title: Re: How to autorun at boot a non runit daemon
Post by: nous on 09 March 2023, 20:01:11
All our inits are made to execute script files in /etc/local.d, *.start at boot and *.stop at shutdown. See https://wiki.artixlinux.org/Main/OpenRC#rc.local for more information.
Title: Re: How to autorun at boot a non runit daemon
Post by: AntonyZ0 on 10 March 2023, 12:54:05
i created two files in /etc/local.d

Code: [Select]
sudo touch /etc/local.d/preload.start

sudo nano /etc/local.d/preload.start

#!/bin/sh

# Start preload service
sudo /usr/bin/preload &

and the second file
Code: [Select]
sudo touch /etc/local.d/vpn.start

sudo nano /etc/local.d/vpn.start
                               
#!/bin/sh
# Start Vpn-Unlimited service
sudo /usr/bin/vpn-unlimited-daemon &

but unfortunately, none of them start
can you help me more?
Title: Re: How to autorun at boot a non runit daemon
Post by: gripped on 10 March 2023, 17:06:45
Have you made them executable ?
eg
Code: [Select]
sudo chmod +x /etc/local.d/preload.start
Title: Re: How to autorun at boot a non runit daemon
Post by: nous on 11 March 2023, 11:57:43
Also, no need for sudo because those scripts are run as root.
Title: Re: How to autorun at boot a non runit daemon
Post by: nous on 11 March 2023, 12:19:53
Also, backgrounding processes may cause the second to fail if it depends on the first and the first hasn't initialized yet. If I were you,I'd put them both in one script and place a 'sleep 3' between them.
Title: Re: How to autorun at boot a non runit daemon
Post by: AntonyZ0 on 16 March 2023, 08:30:04
now I created the below script
Code: [Select]
    GNU nano 7.2                        /etc/local.d/vpn.start                                   
#!/bin/sh
# Start Vpn-Unlimited and preload service
sudo /usr/bin/vpn-unlimited-daemon &
sleep 3
sudo /usr/bin/preload &
  
chmod +x, and it seems ok!

ps, I am not sure about preload, but VPN running!
Title: Re: How to autorun at boot a non runit daemon
Post by: nous on 16 March 2023, 11:02:25
Next!