Login script running multiple times when loging onto a desktop

I have setup a desktop on openSuSE 13.2 to start a terminal and run a script upon login in the .profile file. However, when loging into XFCE the system runs this script multiple times before starting the desktop. Is this an XFCE issue an how can i make this script stop running multiple times? When testing this on openSuSE 13.1 the script doesn’t even run…

START snip - code in .profile >>>

gnome-terminal --window-with-profile=“Login” -e login.ksh

<<< END snip

I’m pretty sure that “.profile” is run automatically as part of Xwindows startup. And it will run again when you start a terminal. Maybe it won’t run if you start an Xterm as a non-login-terminal.

You could have the “.profile” put up an environment variable indicating that the script has run. And it should test this variable before running it, to avoid running a second time.

The terminal starts in succession (runs multiple times right after another…) and this is the odd thing, gnome-terminal runs three times where LXterminal and xterm runs two times. I have put variables into the code and have redirected it to a log file and it shows the script running twice. When the desktop is fully loaded I can start a terminal and “echo $xlogin” it returns “1” (gnome-terminal profile is not running a logon shell)

START Code >>>

xlogin=0

if $xlogin = 0 ]; then
#gnome-terminal --window-with-profile=“ksh-login”
#gnome-terminal --window-with-profile=“ksh-login” -e my_login_script >> PATH_TO_LOGS/login_start.log 2>&1
lxterminal -e ‘bw_login’ >>my_login_script >> PATH_TO_LOGS/login_start.log 2>&
#xterm -e ‘bw_login’ >> my_login_script >> PATH_TO_LOGS/login_start.log 2>&

echo “login Completed with Login: $xlogin” >> PATH_TO_LOGS/login.log 2>&
export xlogin=1
fi

<<< END Code

Logs:

login.log >>

login Completed with Login: 0
login Completed with Login: 0

<<

login_start.log >>
EMPTY
<<