You are not logged in.

#1 2013-04-29 20:42:32

Yuras
Member
Registered: 2012-12-20
Posts: 7
Website

How to run file (script) with systemd.

Hi, i created a file resposible for setting up wireless connection:

#!/bin/bash
ip link set wlp12s0 up
wpa_supplicant -B -Dwext -i wlp12s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpcd wlp12s0

Then i saved it as internet.run into /usr/lib/systemd/system/internet.run, then i typed as root:

systemctl enable internet.service

I had of course internet.service file there too, with nothing special (filled descprition in [Unit] section, and ExecStart in Service), and I didn't work.... I know that the internet.run is written properly because if i type line by line it as root i works fine, but with systemd during boot it don't...

Offline

#2 2013-04-29 20:54:23

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: How to run file (script) with systemd.

There is a dhcpcd@.service and a wpa_supplicant@.service, there is no need to set up any custom scripts.

systemctl enable dhcpcd@wlp12s0

You will have to symlink wpa_supplicant manually because the [Install] section still has wlan0 hardcoded.

ln -s /usr/lib/systemd/system/wpa_supplicant@.service /etc/systemd/system/multi-user.target.wants/wpa_supplicant@wlp12s0.service

Then set up the config in /etc/wpa_supplicant/wpa_supplicant-wlp12s0.conf.

The service file probably doesn't work because you haven't specified Type=forking, so systemd will kill the processes after they have forked. But as said, you don't need any custom service.

Offline

#3 2013-04-29 21:36:51

Yuras
Member
Registered: 2012-12-20
Posts: 7
Website

Re: How to run file (script) with systemd.

Thank you, it worked!

Offline

Board footer

Powered by FluxBB