You are not logged in.

#1 2017-01-02 15:24:12

gorgeous.george
Member
Registered: 2014-10-08
Posts: 11

using systemd to run a script at boot time

Hi all.
Noob here, so please be gentle smile

I want to run a shell script to make my box connect to a wireless network.
The script uses ip and wpa_supplicant.
What's the right way to do this?
I read this section :autostarting
but I am not sure as to what is the best practice here.
I want it to be executed at boot time because I need to ssh into this box to control it, so I cannot just put it in /etc/profile.d and wait for a shell login to execute it.
So I thought a systemd service would be the way to go, but I am not sure about which unit type would suite be the right one: probably OneShot, or maybe idle.
By the way, being run at boot time, how does it handle the fact that it runs ip and wpa_supplicant? are they already available  at boot time? are ip and wpa_supplicant relying on other services to be enabled first?
Lastly, are Cron or systemd Timers better alternatives?

I tried researching this by myself but the amount of possibilities is kind of confusing.

Cheers!

g.g

Offline

#2 2017-01-02 15:33:26

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: using systemd to run a script at boot time

Why not just use systemd-networkd and the wpa_supplicant@ service to handle setting up your network?

No need to write your own service files as everything you need is already installed.

Last edited by Slithery (2017-01-02 15:34:30)


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

Board footer

Powered by FluxBB