How to run a bash script at boot (nethserver7 bare-metal)

I need to execute a bash script at boot (fire up a openvpn client, scp some files and stop)
I think the “official” way to do this is by using actions, but i cant get it at all.
Can someone guided me through this?

Hi @Raulm, I don’t know what you tried until now, but I’d love to share some (obvious) things about Nethserver: under the hood, is “just” a customized version of CentOS7. A the point than unfortunately there’s no updated version (with a fresher kernel) since… too much time, IMVHO.

You referred to Actions, so maybe it’s related to this part of the developer documentation.
https://docs.nethserver.org/projects/nethserver-devel/en/latest/events.html#actions

Maybe you did the right thing but into the wrong place, so… would you please share a bit more about what you tried without success?
Moreover, I’d suggest you a different “angle” for the issue: you wrote

and maybe… at boot is not the right moment/place to do that? Maybe that script should be done after the server had a correct interface connection? Your topic do not specify (yet) your current network setup of your installation and maybe… the firing up of a OpenVPN client (which could be achieved also via Nethserver interface) should be the trigger for scp the files?

Happy Holidays

What i really need is to establish a site-to-site VPN BUT i can’t control the “other” side of the net.
They only give me a .ovpn file.
I never understood how to put this single file into that certificate text box in “tunnel client” tab in the neth-gui
So i fall back into a manually execute a script which first connect to the other host, then scp some files, then rsync another bunch of files and last drop the vpn connection.
So i tried to automatize this process creating a crontab to do it a couple of times a day.
But sometimes (specially when im not in here…) power outages occurs, so i need to run the script automatically when power comes back
(What would solve my problems -and also my users whims- will be a site-to-site nethserver how-to)

Thanks for explaining your goals.
Now: your Nethserver installation which zone use? Only Green? Green+RED?

Green 192.168.200.0/24
Red DHCP provided by isp

So in my personal opinion the connection of OpenVPN (and subsequent commands) should be triggered at every “connection” of the Red interface. :slight_smile:

HTH

THX to everybody. I was able to solve the problem taking a different approach.
I setup a permanent site-to-site vpn between both offices so the users are able to access all shared folders in the main server, so i no longer need to do the sync.
The trick was to edit the provided .ovpn file and extract user, ca and key certificates to fulfill the form in the vpn → client tunnel nethserver gui

1 Like

Mark your post as the solution. Which technically is not, but whatever! :slight_smile:

1 Like

The initial question was not related to the real wish :wink: