LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-20-2005, 09:00 AM   #1
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Rep: Reputation: 33
How to make a program run at start up time.


In windows, we just copy the file to the startup folder and see it run when your computer start.
But in linux how can we do that.
I know that many disto manage to have startx script run at startup time.
But how can I do it myself?
 
Old 10-20-2005, 09:07 AM   #2
Keruskerfuerst
Member
 
Registered: Oct 2005
Location: Lat: 48░23┤56┤┤N, Lon: 10░41┤45┤┤E
Distribution: Gentoo 2006
Posts: 719

Rep: Reputation: 31
Hello!

You can include your script /etc/init.d/rc5.d/

Greetings
 
Old 10-20-2005, 09:40 AM   #3
zak317
Member
 
Registered: Oct 2005
Location: 500$/monthly
Distribution: Mandriva 2006
Posts: 56

Rep: Reputation: 15
If you use KDE, you can put your script in you ~/.kde/Autostart and it will be executed at KDE startup. There is an equivalent for Gnome.

Cheers!
 
Old 10-21-2005, 08:12 AM   #4
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Original Poster
Rep: Reputation: 33
Quote:
Originally posted by zak317
If you use KDE, you can put your script in you ~/.kde/Autostart and it will be executed at KDE startup. There is an equivalent for Gnome.

Cheers!
I want to start that script before either KDE or Gnome start, even before X start.
 
Old 10-21-2005, 08:37 AM   #5
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Original Poster
Rep: Reputation: 33
Quote:
Originally posted by Keruskerf├╝rst
Hello!

You can include your script /etc/init.d/rc5.d/

Greetings
there is no sub dir name rc5.d in /etc/init.d/
ther is directory /etc/rc.d/rc5.d
The script was there but it didn't run.

I think I should post more details.
I have made some changes to the system (I don't remember what did I do) and now,
I have to start X manually. I want it to be start automatically when the system start.
 
Old 10-21-2005, 09:05 AM   #6
zak317
Member
 
Registered: Oct 2005
Location: 500$/monthly
Distribution: Mandriva 2006
Posts: 56

Rep: Reputation: 15
Sure you had to post more details!! To start X automatically, go change de runlevel in your /etc/inittab like this:

# Default runlevel. The runlevels used by Mandrakelinux are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
 
Old 10-22-2005, 03:29 AM   #7
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Original Poster
Rep: Reputation: 33
Quote:
Originally posted by zak317
Sure you had to post more details!! To start X automatically, go change de runlevel in your /etc/inittab like this:

# Default runlevel. The runlevels used by Mandrakelinux are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
I used FC4 not mandrake.
I am in run level 3.
I have set the run level 3, 4, 5 to start them same service. So switch runlevel do not effect me anymore.
I have ordered my PC to start gdm (it will launch X too) automatically but I didn't obey.
 
Old 10-22-2005, 09:28 PM   #8
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Original Poster
Rep: Reputation: 33
Is there any idea?
Please help me.
This is a tetchy problem
Each times my computer start I have to wait until it gives me a console login screen, the login as root, run gdm. After gdm start I have to return the old virtual console to log out to prevent others from earn the root power and then return to gmd to login again.
I can't stand for it anymore

Last edited by TruongAn; 10-22-2005 at 09:33 PM.
 
Old 10-22-2005, 11:04 PM   #9
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
The previous post about fixing your starting run-level was actually correct for both Mandrake and Fedora (Redhat too).
You need to stop booting into runlevel 3, and switch it to runlevel 5 by editing your inittab file.
Also, right now when you boot to run level 3, do not log in as root. Instead log in as your regular user account and type 'startx'.. thats all.

Before you do any of the above however, try this test...
Boot up like you are currently doing where it stops at run level 3 and you get a console. Then log in as root and type 'init 5'.
If X does not start then you have some other problem going on and you need to fix that before proceeding.
 
Old 10-24-2005, 09:01 AM   #10
zak317
Member
 
Registered: Oct 2005
Location: 500$/monthly
Distribution: Mandriva 2006
Posts: 56

Rep: Reputation: 15
Also take a look at your kernel options at boot so you don't have any exotic option like "failsafe"....D'oh!

Do you have any error message when you start X?
 
Old 10-24-2005, 09:45 AM   #11
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Original Poster
Rep: Reputation: 33
Quote:
Originally posted by zak317
Also take a look at your kernel options at boot so you don't have any exotic option like "failsafe"....D'oh!

Do you have any error message when you start X?
There is no failsafe terminal in FC4.
X satrt OK.
But the matter is it doesn't start automatically.
I want it to start automatically.
I don't want to manually start everytime my PC opened
 
Old 10-24-2005, 10:22 AM   #12
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Original Poster
Rep: Reputation: 33
Quote:
Originally posted by randyding
The previous post about fixing your starting run-level was actually correct for both Mandrake and Fedora (Redhat too).
You need to stop booting into runlevel 3, and switch it to runlevel 5 by editing your inittab file.
Also, right now when you boot to run level 3, do not log in as root. Instead log in as your regular user account and type 'startx'.. thats all.

Before you do any of the above however, try this test...
Boot up like you are currently doing where it stops at run level 3 and you get a console. Then log in as root and type 'init 5'.
If X does not start then you have some other problem going on and you need to fix that before proceeding.
Run level 5 work for me now.
But I don't understand.
Run level 3 used to work for me long ago.
The content of folder /etc/rc.d/rc3.d and /etc/rc.d/rc4.d is the same.
I have used system-config-services provided by FC to set the run level 3,4,5 to the same.

Why 5 works 3 doesn't.?
How can I fix my run level 3?
If I destroy runlevel 5 in the future what I will have to do.?
Can I back up run level 5 to level 4?
 
Old 10-24-2005, 10:22 AM   #13
zak317
Member
 
Registered: Oct 2005
Location: 500$/monthly
Distribution: Mandriva 2006
Posts: 56

Rep: Reputation: 15
And did you put id:5:initdefault: in your /etc/inittab??
 
Old 10-24-2005, 10:51 AM   #14
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Original Poster
Rep: Reputation: 33
Quote:
Originally posted by zak317
And did you put id:5:initdefault: in your /etc/inittab??
Yes, I did. But how can I fix my run level 3.
 
Old 10-24-2005, 11:36 PM   #15
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
From the descriptions so far, it seems your run-level 3 is working correctly.
If it boots up and stops at run-level 3 with a black console screen and login promp... that's correct for run-level 3.
If there's another problem with run-level 3 I don't recall what it was after re-reading the previous posts. Please explain what you think was wrong one more time for us.
 
  


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
run program automatically at specific time simon_qwl Programming 2 03-20-2005 10:58 AM
How to start a program at bootup time? shilpig Linux - Software 6 09-28-2004 01:45 PM
Start a program at boot time cppkid Programming 3 08-31-2004 09:33 AM
i want to run a script or program at boot time!! FreakboY Linux - Newbie 9 10-12-2003 08:03 AM
call other program at run time Xiangbuilder Programming 4 10-01-2003 09:53 AM


All times are GMT -5. The time now is 07:22 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration