I want to start screen and put a couple of programs running inside on startup. I've seen many similar posts but none answered my question.
so I put in
rc.local following 2 lines:
screen -dmS scr bash -c 'ytop; exec bash' screen -S scr -X screen 1 bash -c 'nvtop; exec bash'
which works fine, but when I enter this screen, once logged in to the server, and want to create new screen, it doesn't have environment variables in it. How can I start it in the way that would have all root's envars?
new window looks like this:
$PATH in window is
Yet in the
rc.local created windows
/usr/bin:/bin) is the same, but the prompt is normal, so it looks that it reads
Window initialized by rc.local has normal prompt:
PATH is also a bit more than fresh window, but not same as if I start screen manually from the terminal as root
echo $PATH usr/lib64/qt-3.3/bin:/usr/bin:/bin
When I start screen by myself it's normal prompt.
echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Interestingly if I exit
ytop it shows me proper prompt. Only when creating new screen somehow looses this envars.
I tried also running:
su - root -c `screen -dmS scr bash -c 'ytop; exec bash'`
but I get the same result.