Jey10 Jey10 - 1 year ago 68
Linux Question

Bash not executed after the user logging

I'm trying to execute a script after the user is logged in but it's not working.

I have created a script which is executing a docker with the command "docker exec" and a shell bash. After this, some commands are executed into the shell to launch a specific application.

I have put this script into the folder /etc/profile.d/ but nothing happens after the user is logged in.

I have also tested a simple script with a simple command "mkdir" on the user home directory and this is working so I think that the problem is caused of the shell bash into the docker.

Here is the script :

xhost +local:of_v1606_plus
docker start of_v1606_plus
docker exec -it of_v1606_plus bash --rcfile '/opt/application/setImage_v1606+' -c 'cd /home/user/application/run/ ; application'

Answer Source

I had the same problem and I used xdg. You have just to create a .desktop with this format :

[Desktop Entry]
Name=Application Name
Comment=Application Comment
Exec= your program or path

You can add other options if you need.

After this, put your .desktop file into /etc/xdg/autostart/

Your program should run after the user logon.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download