How To Run A Script After Network Initialisation on Raspbian

  • raspbian-lite
  • bash
  • systemctl

I have a raspberry pi configured to share my wifi internet through the ethernet port, so that I can turn my dump ethernet printer to a wifi accessible one.

I do this by using the setup guide at

There’s a script that I have to run for internet sharing to kick off at

But I also want to run this script after the network initialisation of raspbian lite. This is how I could do this.

Create a Systemd Service

Go to /etc/systemd/system/.

Create a new service by the name start-internet-sharing.service and add the following in there.

Description=Start Sharing Internet



Note: I have the above script downloaded at /etc/init.d/ Wants and After above will declare the requirement and the event to run the script on.

That’s it. Restart the rpi and whatever the script you want to run will run after network initialisation.

Written on June 5, 2019