LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   start up vs rc.local (https://www.linuxquestions.org/questions/linux-newbie-8/start-up-vs-rc-local-4175508609/)

unclesamcrazy 06-20-2014 06:34 AM

start up vs rc.local
 
Log out and log in again is enough to execute script mentioned in Start up Applications but it needs complete restart to execute script mentioned in rc.local file.
why?

TobiSGD 06-20-2014 07:45 AM

Because the rc.local script is called by the init system at boot time, while the Start up Applications system is managed by your desktop environment. Both serve different purposes, rc.local is the place for things you want run only once at boot systemwide, while the Start up Applications system is for things that have to be started on a per user basis (different users can have different applications there).

unclesamcrazy 06-20-2014 08:26 AM

Thanks for the accurate answer.
one more thing,
Start up applications are stored in ~/.config/autostart as .desktop files.
If a Linux system has no desktop environment (only command line), the black screen with prompt appears when system boots successfully, in this case, the .desktop file can not be generated, correct? or still generated and used?

Can each user define start up task for his account using .desktop file but when there is no desktop environment then can he update rc.local for his account to run a script ?

Thanks again for your proper response.

TobiSGD 06-21-2014 08:50 PM

Files in ~/.config/autostart are only used for starting applications if the desktop environment supports that. If you don't start a desktop environment those files will not be used.
For per user application starting without a desktop environment usually the configuration file of the user's shell is used, in most cases ~/.bashrc.
rc.local can not be used for user specific settings or application starts, it is executed before the login prompt even appears and can not know which user will log in.

selfprogrammed 06-24-2014 10:30 PM

Login will execute /sbin/bash --login
This will execute /etc/profile, which is where your prompt style is set, the PATH is set
and other things.
The user may have a ~/.profile which will be executed next.
Each user can put any bash script in their own profile. Including modified lines from /etc/profile is the usual use, or making a simple prompt style (maybe because including directory name in the prompt string has become a problem).

This applies to any login.

If you open a Konsole and do not see the colors when you "ls" (like you do when you use a real console), then fix that as follows:
Start Konsole, select profile settings from the menu, edit the profile you are using (usually shell), and change the line "/sbin/bash" to "/sbin/bash --login".
This will then also run the profile scripts when using Konsole.

I run Slackware. If you do not find profile, then it may be bashrc or some other file name on your distribution.


All times are GMT -5. The time now is 08:41 AM.