Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Distributions
User Name
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.


  Search this Thread
Old 06-15-2003, 08:21 PM   #1
LQ Newbie
Registered: Apr 2003
Location: Oklahoma
Distribution: Redhat
Posts: 25

Rep: Reputation: 15
Autoexec.bat Equivalent

I wish to execute a command shell entry (a command) each time the computer starts. How would I set this up? In a Windows machine I would simply edit the autoexec.bat file to include my command. Is there a similar file in Linux, particularly SuSE 8.1?


Old 06-15-2003, 09:45 PM   #2
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,347

Rep: Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552

You might try /etc/init.d/boot.local
Old 06-15-2003, 11:07 PM   #3
Registered: Nov 2002
Location: Paraguay
Distribution: Mandrake 10
Posts: 573

Rep: Reputation: 30
You have many options. You can edit ~/.bashrc if you want the script to run every time a user logs in (~ is the home direcotry of the user) You can edit /etc/bash_profile so it runs every time ANY user logs in. You can edit /etc/rc.d/rc.local if you want it to run every time you start the computer. or /etc/rc.d/rc.# where # is the runlevel number in which you want the script to run.
Old 06-15-2003, 11:30 PM   #4
Registered: Apr 2002
Location: Albuquerque, NM USA
Distribution: Slackware, Ubuntu, Debian, Maemo
Posts: 464

Rep: Reputation: 30
Linux and Unix OS's typically have a large set of "autoexec.bat"-like files arranged in an amazingly complicated yet versitile structure. To make matters worse, this structure varies somewhat between Linux distributions. For "SysV" based distributions (most are) there is a whole set of "autoexec.bat"-like files that are in /etc/init.d. These are optionally executed in an order described in directories named after the "run-level" they work for such as "rc3.d" or "rc5.d". The files are executed in alphabetical order which is why the numbers are prefixed to them.

If this isn't complicated enough for you, rest assured that I've left out a lot of details. However it is worth learning about all this because you can then learn how to customize your system startup, and learn how to start & stop services on the fly after your system is running.
Old 06-15-2003, 11:33 PM   #5
Registered: Feb 2003
Posts: 37

Rep: Reputation: 15
Wow. .what they said...
/etc/rc.d/rc3.d/S99whatever will run stuff for multi user non gui type situations.
/etc/rc.d/rc5.d/S99whatever will run stuff for multi user gui type situations.

there's also ~/.bashrc and /etc/init.d/boot.local
but I prefer rc5.d.

shoot me a message if you need specific help.
Old 06-16-2003, 09:51 AM   #6
Registered: Apr 2003
Location: Florida
Distribution: Redhat 7.2
Posts: 222

Rep: Reputation: 30
try /etc/rc.local


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
Is there an equivalent of autoexec.bat in debian? Akhran Debian 5 09-13-2005 05:58 PM
What is the autoexec.bat and config.sys equivalent of linux lemuel Linux - Newbie 4 12-07-2004 09:34 PM
Linux Startup - AutoExec.bat equivalent? perry Linux - Software 6 05-03-2004 11:13 PM
Autoexec.bat in Linux? sikandar Linux - Software 10 08-31-2003 12:30 PM
The Linux version of autoexec.bat ??? Canaris Linux - Newbie 9 05-27-2003 07:35 AM > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 11:39 PM.

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