LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 02-27-2004, 04:56 PM   #1
TuxTimo
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Rep: Reputation: 0
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.
 
Old 02-27-2004, 05:17 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
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.
 
Old 02-27-2004, 05:19 PM   #3
dford
Member
 
Registered: May 2003
Location: Kansas
Distribution: RH 9, OpenBSD, FreeBSD
Posts: 60

Rep: Reputation: 19
"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 05:21 PM.
 
Old 02-27-2004, 05:22 PM   #4
TuxTimo
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Original Poster
Rep: Reputation: 0
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?
 
Old 02-27-2004, 05:30 PM   #5
tk31337
Member
 
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Linux Mint
Posts: 194

Rep: Reputation: 32
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.
 
Old 02-27-2004, 05:31 PM   #6
dford
Member
 
Registered: May 2003
Location: Kansas
Distribution: RH 9, OpenBSD, FreeBSD
Posts: 60

Rep: Reputation: 19
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.
 
Old 02-27-2004, 06:11 PM   #7
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Running Xscreensaver at Startup burningsun1981 DamnSmallLinux 1 07-04-2005 02:04 AM
Running Programs at Startup burningsun1981 Linux - Newbie 2 07-03-2005 08:56 PM
running a command on startup scankyfrank Linux - General 8 05-08-2005 06:03 PM
Programs Running On Startup skate Linux - Newbie 1 10-14-2003 05:34 AM
Running a command on startup? flamesrock Linux - Software 5 09-07-2003 12:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:56 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration