Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-27-2004, 03:56 PM
|
#1
|
LQ Newbie
Registered: Feb 2004
Posts: 2
Rep:
|
Running a command at Startup
Hi Guys,
I'm new here, but I have experience on other boards like this... I think this is quite an obvious question, and probably been asked before. I did search for it, and it didnt turn anything up, so ill ask here.
Well there are some commands I would like to run when I start my machine up, on the computers at Uni, you can just edit the .login file to do this, but on my home linux distro (im running Fedora Core 1, btw), how could I achieve this?
I tried .login, but I cant do it like that... any other ideas?
Cheers,
Tim.
|
|
|
02-27-2004, 04:17 PM
|
#2
|
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113
Rep: 
|
You mean at login or startup? For login, there's ~/.bash_profile (which goes to ~/.bashrc) and there's ~/.bash_login and/or ~/.profile. For system startup, /etc/rc.d/rc.local in Slack. Not sure in Fedora.
|
|
|
02-27-2004, 04:19 PM
|
#3
|
Member
Registered: May 2003
Location: Kansas
Distribution: RH 9, OpenBSD, FreeBSD
Posts: 60
Rep:
|
"On startup" means system bootup, user login or startup of a shell?
The answers are: /etc/rc.d/rc, .bash_profile, and .bashrc respectively. This assumes your shell is bash.
For more info on the rc.d stuff look at Starting Your Software Automatically on Boot
Last edited by dford; 02-27-2004 at 04:21 PM.
|
|
|
02-27-2004, 04:22 PM
|
#4
|
LQ Newbie
Registered: Feb 2004
Posts: 2
Original Poster
Rep:
|
well, system bootup, because I want to be able to run it even if I dont login...
Not really sure what shell im using... how could I find out?
|
|
|
02-27-2004, 04:30 PM
|
#5
|
Member
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Linux Mint
Posts: 194
Rep:
|
For system bootup it's technically best to make a script in /etc/init.d/ and create a symlink in /etc/rc.d/rc[run-level #]. Just putting a script in the runlevel dir will work too though, but a symlink conserves space and is the standard method.
Anyhow, this doesn't apply to your situation, but if anyone wants a graphical prog to startup when they login, and they're using KDE, there's the ~/.kde/Autostart dir, in which you can actually drag over a desktop link into, and have that link executed when KDE starts.
|
|
|
02-27-2004, 04:31 PM
|
#6
|
Member
Registered: May 2003
Location: Kansas
Distribution: RH 9, OpenBSD, FreeBSD
Posts: 60
Rep:
|
If you want this to run on Boot, your shell doesn't matter. However, to find out a quick way to tell what shell you are in is to type the ps command.
The link I gave you should give you the info to run a command on Boot.
If you want to run a command periodically, not just on boot, then you should look in to cron and crontab
Let me know if you need more info.
|
|
|
02-27-2004, 05:11 PM
|
#7
|
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113
Rep: 
|
Quote:
Originally posted by TuxTimo
Not really sure what shell im using... how could I find out?
|
echo $SHELL
or
echo $0
should say, as well as the ps and then you don't need to eyeball it.
If you mean whether you login at all or not, then, yeah, it'd be a system runlevel file. But if you mean whether it's a login shell or not, then ~/.bashrc will do it.
|
|
|
All times are GMT -5. The time now is 10:37 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|