How can one run a shell script just before the desktop session begins?
Rather than executing the script before session begins, you can execute it as soon as session begins. For an end user, this does not make difference as scripts would have started executing when you see your session.The steps are as follows.
Create a shell script and provide it necessary permissions.
Open
startup applications
by searching in dash or your menu, depending on your OS.Click on Add.
Give a name and add the command, which would be location of your script.You may also add a optional comment.
Click on add, ensure that script is selected and then close the window.
Next time the script would be executed on startup.