1

I am working on an embedded system which is running on NUC / Ubuntu 16.04 I would like that when I start the NUC, it automatically start a set of applications and also enable Wifi to automatically connect to a given network because these applications exchange information with a remote computer.

What I did first, is creating a shell script which is launching all the applications from a user directory /home/xxx and it works fine but I need to start the NUC and open a session on the terminal to enable Wifi (wifi is not enabled on boot).

From my research I read a thread providing very good information about the different possibilities to do it (How to run scripts on start up?) - but the question for me is how to fill the blanks:

Is it possible to open a user session (and thus enable Wifi to connect automatically to our local wifi network) and then start the shell script?

I have found this example below:

Create the folder /etc/systemd/system/getty@tty1.service.d

Create the file /etc/systemd/system/getty@tty1.service.d/override.conf

Open the file with your favorite editor and add this:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM
Type=idle

Replace myusername with your user name.

But then how to start the script?

Thank you very much for your help

fabrice
  • 21

1 Answers1

0

I know this is a year old, but I was trying to figure this out yesterday (exactly a year after this question was asked) and today. I finally figured it out after a million (slightly exaggerated) Google searches. I found the solution here which says to add the following conditional in the ~/.profile file:

if [[ "$(tty)" == "/dev/tty1" ]]; then
  # do whatever you want here
fi

You can change tty1 according to your specific needs. And, of course, replace the comment with the command or script that you would like to run. This solution works perfectly for me on Ubuntu Server 18.04.3.