Okay, I've found a solution to my initial problem. It's dirty one though.
First of all, using
~/.profile or even
/etc/profile.d/ should be preferred methods instead (here's good reading on the subject). Don't know why it doesn't work for me; perhaps it has something to do with my display manager auto logon workaround, just a guess.
Another solution would be adding script shortcuts to global file that gets executed at startup, for instance
Since my script requires xserver and user to be logged on, I created initfile which waits after bootup for xserver and user to be logged on and then executes the script:
### BEGIN INIT INFO
# Provides: script_file.sh startup at boot
# Required-Start: $all
# Default-Start: 2 3 4 5
# Description: runs '/usr/local/bin/script_file.sh --optional --flags' at startup, when xserver has started and YOURUSERNAME is logged on.
### END INIT INFO
case "$1" in
# Wait until X is running and required user logged in:
until [[ "$(tty)" != "\/dev\/tty1" ]] && [[ "$(who | cut -d' ' -f1 | sort | uniq)" == "YOURUSERNAME" ]]; do
if [[ "$count" == "10" ]]; then
echo "Xserver hasn't started or other error occurred. Abort"; exit 1
# Run the script as YOURUSERNAME instead of root:
su - YOURUSERNAME -c '/usr/local/bin/script_file.sh --optional --flags'
This soulution assumes having automatic log-on set up. As mentioned, it really isn't the way to do it, but works for now.