LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-30-2004, 10:27 AM   #1
caged
Member
 
Registered: Jan 2004
Location: new zealand
Distribution: Mandrake,Slackware
Posts: 165

Rep: Reputation: 30
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.
thanks.
Ben.
 
Old 05-30-2004, 10:38 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Take a look in /etc/rc.d/ - these scripts are initially kicked off from /etc/inittab.
 
Old 05-30-2004, 11:06 AM   #3
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
http://www.redhat-linux.com.my/faq/boot18.html
 
Old 05-30-2004, 11:30 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
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)
 
Old 06-02-2004, 09:24 PM   #5
caged
Member
 
Registered: Jan 2004
Location: new zealand
Distribution: Mandrake,Slackware
Posts: 165

Original Poster
Rep: Reputation: 30
ok,

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.
Ben.
 
Old 06-02-2004, 09:32 PM   #6
Shade
Senior Member
 
Registered: Mar 2003
Location: Burke, VA
Distribution: RHEL, Slackware, Ubuntu, Fedora
Posts: 1,418
Blog Entries: 1

Rep: Reputation: 46
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:

Code:
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 www.tldp.org 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 www.freebsd.org in the freebsd handbook, which is also an excellent source of dry, easy to follow information.

--Shade
 
Old 06-02-2004, 11:38 PM   #7
caged
Member
 
Registered: Jan 2004
Location: new zealand
Distribution: Mandrake,Slackware
Posts: 165

Original Poster
Rep: Reputation: 30
awesome, thanks dude.

i noticed after adding and editing the .bashrc file nothing changed at login but the terminal sessions were a bit odd.
 
Old 06-02-2004, 11:58 PM   #8
Shade
Senior Member
 
Registered: Mar 2003
Location: Burke, VA
Distribution: RHEL, Slackware, Ubuntu, Fedora
Posts: 1,418
Blog Entries: 1

Rep: Reputation: 46
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.

--Shade
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing Start up scripts question Neruocomp Red Hat 1 09-09-2005 01:43 PM
start up scripts on gentoo mdpniesta Linux - Software 1 03-08-2005 04:40 AM
debian start up scripts? pgte3 Debian 7 08-25-2004 06:42 PM
Start Up Scripts not running MaverickApollo Linux - General 3 10-20-2003 09:31 PM
Start Up Scripts in Linux clintonm9 Linux - Software 3 06-24-2003 09:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration