Page 1 of 1

[Solved] Running a command at boot?

Posted: Thu Aug 01, 2019 12:34 am
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.

Re: [Solved] Running a command at boot?

Posted: Sun Aug 04, 2019 10:32 am
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

Re: [Solved] Running a command at boot?

Posted: Sun Aug 04, 2019 4:15 pm
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 wg-quick@wg0.

Works reliably for me.

Re: [Solved] Running a command at boot?

Posted: Tue Aug 06, 2019 11:07 pm
by ghettopi
Totila wrote: Sun Aug 04, 2019 4: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 wg-quick@wg0.

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?