[SOLVED]How to execute script with sudo using session and startup?

Message
Author
User avatar
Head_on_a_Stick
Posts: 919
Joined: Sun Mar 17, 2019 3:37 pm

Re: How to execute script with sudo using session and startup?

#11 Post by Head_on_a_Stick »

acecombat2 wrote: Sun Jan 19, 2020 10:17 am If I understood correctly, following dolphin_oracle instruction automatically the script will run as part of systemd boot sequence?
Actually you can just use systemctl to enable it.

I saved your script to /etc/init.d/vbox and made it executable then:

Code: Select all

empty@mx:~
$ sudo systemctl enable --now vbox
vbox.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable vbox
empty@mx:~
$ systemctl is-enabled vbox
vbox.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install is-enabled vbox
enabled
empty@mx:~
$
Seems to work :-)
mod note: Signature removed, please read the forum rules

User avatar
fehlix
Developer
Posts: 12706
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to execute script with sudo using session and startup?

#12 Post by fehlix »

acecombat2 wrote: Sun Jan 19, 2020 10:17 am If I understood correctly, following dolphin_oracle instruction automatically the script will run as part of systemd boot sequence? I'm still in learning curve albeit, slowly.
If you installed the sysvinit (init.d) script when booted with sysvinit - not with systemd -, the systemd entries will also be generated to be available when booted with systemd.

User avatar
acecombat2
Posts: 12
Joined: Sun Sep 01, 2019 2:22 pm

Re: How to execute script with sudo using session and startup?

#13 Post by acecombat2 »

Head_on_a_Stick wrote: Sun Jan 19, 2020 11:24 am
acecombat2 wrote: Sun Jan 19, 2020 10:17 am If I understood correctly, following dolphin_oracle instruction automatically the script will run as part of systemd boot sequence?
Actually you can just use systemctl to enable it.

I saved your script to /etc/init.d/vbox and made it executable then:

Code: Select all

empty@mx:~
$ sudo systemctl enable --now vbox
vbox.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable vbox
empty@mx:~
$ systemctl is-enabled vbox
vbox.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install is-enabled vbox
enabled
empty@mx:~
$
Seems to work :-)
Nifty! Thank you for showing to me of how to do it. am not ready yet to delve in hacking sysvinit shell script into systemd unit.

fehlix wrote: Sun Jan 19, 2020 5:35 pm
acecombat2 wrote: Sun Jan 19, 2020 10:17 am If I understood correctly, following dolphin_oracle instruction automatically the script will run as part of systemd boot sequence? I'm still in learning curve albeit, slowly.
If you installed the sysvinit (init.d) script when booted with sysvinit - not with systemd -, the systemd entries will also be generated to be available when booted with systemd.
Got it. Now we have 3 options to go about it.

I'm going to try with these alternatives.

Post Reply

Return to “Software / Configuration”