LinuxQuestions.org
Visit Jeremy's Blog.
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 02-10-2005, 01:54 PM   #1
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Rep: Reputation: 15
How do I make a command run as root at boot up under Fedora 3?


I have a file that looks like this:

Code:
#!/bin/bash

/usr/local/mysql/bin/mysqld_safe --user=mysql &

and I want it to run at boot as root user. I tried putting it in /etc/rc.d/init.d but that didn't work. I figured I better ask you guys where the proper place for it is since lots of people ask me questions about linux and I don't have to tell them somthing improper if I can help it anyway.

Thanks, guys.
 
Old 02-10-2005, 02:09 PM   #2
coureyv
LQ Newbie
 
Registered: Feb 2003
Posts: 18

Rep: Reputation: 0
you see /etc/init.d/rc5.d into the scripts when you go in init 5 when normal mysql is already runniin ?
cxy
 
Old 02-10-2005, 02:36 PM   #3
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by coureyv
you see /etc/init.d/rc5.d into the scripts when you go in init 5 when normal mysql is already runniin ?
cxy

I don't understand what you said here. I don't know what all the rc#.d folders do... only have clues. I know they cause things to start up at boot. MySQL doesn't run until I start it up with the command shown above. I don't understand how I can "see" anything going though any init stage.
 
Old 02-10-2005, 02:43 PM   #4
coureyv
LQ Newbie
 
Registered: Feb 2003
Posts: 18

Rep: Reputation: 0
easy, /etc/init.d/rc(i).d are directories where scripts are executed for init level 1 rc1.d, ... init level 5 rc5.d
At this stage if you want to run at boot a script you place it in the good level into an existing script or (more complex) you create your personnal script. Good luck
 
Old 02-10-2005, 03:02 PM   #5
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Original Poster
Rep: Reputation: 15
How do I create my own script? I've wented to know how to do that for a while. I think I'm ready to take that on.
 
Old 02-10-2005, 06:22 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
There most likely is a mysql script in /etc/init.d but you don't have it selected to start at boot up. Does the command 'service mysql start' or 'service mysqld start' bring up the service. You could use the 'chkconfig' command as root to start the mysql daemon to start when you boot up.
chkconfig --list will print out a table of services and the runlevels they start in. It also gives the instructions to use to start a service on a certain run level. You probably want to start 'mysqld' under runlevels 3 and 5. There may be a second related service, but I'm not at my linux box to check. 'info mysql' may give more information.

Here is a skeleton InitV script for redhat:
http://lightconsulting.com/~thalakan/rhsysv-skeleton
If you notice the comment line in the script:# chkconfig: 2345 55 25
This line is used by chkconfig, so your script needs it. In other words, this is more than a comment line.

The scripts in /etc/init.d/ are linked to /etc/rc.d/rc.3 for example.
The number after 'rc.' is the run level where these scripts will start.
Scripts beginning with the letter 'S' are started during boot up in alphabetical order. Scripts starting with the letter 'K' are run during shutdown. Again, these are links to the scripts in /etc/init.d (same as /etc/rc.d/init.d, i.e. one directory location is a symbolic link to the other. )

There is also an /etc/rc.d/rc.local script that will run after the rc.d scripts run. However for the mysql server, you probably want to use the script that the system runs in /etc/init.d/ .

There may be a red hat gui'd equivalent to the 'chkconfig' program, for starting services.

Good Luck!

Last edited by jschiwal; 02-10-2005 at 06:47 PM.
 
  


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
A bash puzzle: queue up command for root to run? rose_bud4201 Programming 14 11-21-2005 04:14 PM
how to make cifs run as root cdavidson Linux - Newbie 7 03-19-2005 10:32 PM
make a command run at startup? cheater1034 Linux - General 2 09-12-2004 05:51 AM
where do i add a command to make it run on boot stuart Linux - Newbie 4 06-21-2004 06:03 PM
Is their a way to run a command as root..or another user.. in php BaerRS Programming 2 04-25-2002 02:38 PM


All times are GMT -5. The time now is 04:45 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