-   Slackware (
-   -   Start up scripts??? (

caged 05-30-2004 10:27 AM

Start up scripts???
Hi im curious as to what all the startup files are that slackware uses.
files like the autoexec.bat file from dos that runs when dos starts up. from reading other questions i can see there are rc.local and some others but i was hoping for some others so i can run a particular startup script when a particular user logs in or when x starts etc. do these files exist or are their any other ways people can think of to get around this.

david_ross 05-30-2004 10:38 AM

Take a look in /etc/rc.d/ - these scripts are initially kicked off from /etc/inittab.

whansard 05-30-2004 11:06 AM

keefaz 05-30-2004 11:30 AM


i was hoping for some others so i can run a particular startup script when a particular user logs in or when x starts etc.
- to do stuff when an user login : first you have to know what shell he uses by looking at /etc/passwd (the shell is the last info, eg /bin/bash).
for bash : edit .bashrc in the user directory, for csh .profile... for others use man +shell name to see what the shell init file is.
- to do stuff when startx, edit the appropriate xinitrc file in /etc/X11/xinit (the config that correspond to the window manager)

caged 06-02-2004 09:24 PM


all users are using the bash shell (hey i just said shell twice) there is no ".bashrc" file in the users home directory. if i just create one and add the code i want into it will the system find it ok? or shall i tell another file somewhere that the file exists now?

have fun.

Shade 06-02-2004 09:32 PM

When you login with a new shell, bash reads /etc/profile and /home/user/.bash_profile if it exists.

Slackware doesn't have a .bash_profile in the user's directory by default, but just create it with the aliases, functions, or commands you want to run on login and bash will find and use it.

You can also invoke, or start, bash as a subshell -- meaning it's not a log-in, just another process running under your current shell. When bash starts in this manner, it doesn't read the profiles... It looks for /etc/bashrc or /home/user/.bashrc

A simple way to get bash to read the log-in commands, aliases, etc every time a new instance is started is to keep all of your customizations in /home/user/.bash_profile and then simply have these two lines in your .bashrc:


source /etc/profile
source ~/.bash_profile

Thus, .bash_profile is read on login, and from a subshell, as referenced through .bashrc

Also, on another note, Slackware uses BSD style initscripts, rather than the System V style most other linux distrobutions use. The layout of the /etc/rc.d/ directory is a bit different, but in my opinion, more straightforward.

There is a HOW-TO at called "From Boot to Bash" which goes over the whole boot process, if you're interested. There may also be a bit on this at in the freebsd handbook, which is also an excellent source of dry, easy to follow information.


caged 06-02-2004 11:38 PM

awesome, thanks dude.

i noticed after adding and editing the .bashrc file nothing changed at login but the terminal sessions were a bit odd. :)

Shade 06-02-2004 11:58 PM

Yeah, it takes but a mere moment to wrap your head around it. Once you get it, it's quite simple.

I just leave .bashrc the same and add all my stuff to .bash_profile

That way, whenever you start a terminal session, or log in, you're always dealing with the same thing. That's the way I like it.

I can, however, envision instances where I wouldn't want them both to be the same.
Say for example -- I like having fortune show up on log in. But it gets annoying if it starts with every single aterm or xterm.. So you could just include source .bash_profile and include your PS1 prompt setting in there, to have a uniform prompt but no fortune in xterms, etc.


All times are GMT -5. The time now is 09:16 AM.