0

I need a solutions for creating a configuration script which should be executed only by the first boot of the machine. I want to configure new network interfaces through the script with parameters which are inputed by the user. There are various ways to do that. My guess was systemd.

I tried to write a systemd script like this:

[Unit]
Decription=Network Configuration Service

[Service] Type=simple ExecStart=/home/configure-network

[Install] WantedBy=multi-user.target

The systemd service is working fine, but I can't see any outputs of my script on the terminal even if I only use the echo command. What would be the best way to execute my script on startup for the very first time of the system boot. When my system is up and I connect through ssh the script should be executed once and the user should be able to put the parameters sequentially.

My problem is only the execution of the script on boot/startup only once.

Dex
  • 1
  • Something escapes me. You want the script to be run only "on first boot" but then refer to the user putting in parameters? – vanadium Mar 01 '22 at 12:14
  • @vanadium sorry, maybe i dismiss something. So i want to execute a script when i connect through ssh on the machine for the first time. I want to make an image of the os, when this is installed the script is executed and the parameters can be given by user input. My problem is idk how to execute the script on boot or startup or whatever the best way is for my problem. – Dex Mar 01 '22 at 12:29
  • @JacobVlijm I don't get it, the script which is executed is irrelevant, i only want to execute it on boot/startup or whatever the best way is. My Problem is that i cant see even nothing, neither the echo. How can i see the lines executed on the terminal to be able to input. – Dex Mar 01 '22 at 12:31
  • 1
    This existing question details how to run scripts on startup: How to run scripts on start up? Now to this add a method to execute only once. This can be done by creating a file, and only running the script if this file does not exist. – Artur Meinild Mar 04 '22 at 13:15

0 Answers0