[Solved] Running a command at boot?

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
ghettopi
Posts: 42
Joined: Tue Jul 30, 2019 8:17 pm

[Solved] Running a command at boot?

Post by ghettopi »

Hi,

I borked my installation by auto enabling Wireguard every time at boot which is not letting me SSH into the system or access any of the services running on my device.

I'd like to run a simple command at boot that would disable Wireguard from running automatically. Then after rebooting the device, I would be able to SSH into it like normal. This would need to be done by editing a config file on the MicroSD that runs the command after all services have been started.

How do I do this?

Thanks.

EDIT: Solved my own problem.
Opened up the 'postboot' file on my SD card in the dietpi folder, added a line right after the 'start services' command.
Turned on the Pi. Waited at least 5 minutes.
Turned off the Pi. Turned it back on.
Tried SSH and voilá it works and Wireguard is off thanks to the command I got it to run after starting all services when the boot finished. Phew.

Totila
Posts: 6
Joined: Sun Aug 04, 2019 7:29 am

Re: [Solved] Running a command at boot?

Post by Totila »

Could you explain what you put where exactly?

I want to schiebe the oppposite, i.e. start wireguard after boot. (Starting the service fails for some reason, If I start by hand once boot is finished, it works, so ist could be a timing issue)

I could with an Idea how to do that. (Starting a service once boot is finished)

Many thanks in advance.

-K

Totila
Posts: 6
Joined: Sun Aug 04, 2019 7:29 am

Re: [Solved] Running a command at boot?

Post by Totila »

I think I found one way I am happy with for now.

FWIW

I simply added a script into the dietpi postboot.d folder.
And within that one-line-script I start wireguard service via systemctl start [email protected]

Works reliably for me.

ghettopi
Posts: 42
Joined: Tue Jul 30, 2019 8:17 pm

Re: [Solved] Running a command at boot?

Post by ghettopi »

Totila wrote:
Sun Aug 04, 2019 3:15 pm
I think I found one way I am happy with for now.

FWIW

I simply added a script into the dietpi postboot.d folder.
And within that one-line-script I start wireguard service via systemctl start [email protected]

Works reliably for me.
Sorry I didn't get to you in time, but I'm glad you sorted it out quickly. Actually it just so happens that I am having a serious problem with Wireguard.

My thread is here: viewtopic.php?f=11&p=19049#p19049

Would you happen to know what the problem is?

Post Reply