LinuxQuestions.org
Help answer threads with 0 replies.
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 05-28-2001, 07:51 PM   #1
epic
Member
 
Registered: May 2001
Location: Shanghai,China
Distribution: Gentoo Linux 1.3b
Posts: 51

Rep: Reputation: 15


I installed the apache-1.3.20 and MySQL-3.23.38 on my RedHat7.1 ,but When I modified rc.local in /etc/ec.d to this



code:
--------------------------------------------------------------------------------#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

if [ -f /etc/redhat-release ]; then
R=$(cat /etc/redhat-release)

arch=$(uname -m)
a="a"
case "_$arch" in
_a*) a="an";;
_i*) a="an";;
esac

NUMPROC=`egrep -c "^cpu[0-9]+" /proc/stat`
if [ "$NUMPROC" -gt "1" ]; then
SMP="$NUMPROC-processor "
if [ "$NUMPROC" = "8" -o "$NUMPROC" = "11" ]; then
a="an"
else
a="a"
fi
fi

# This will overwrite /etc/issue at every boot. So, make any changes you
# want to make to /etc/issue here or you will lose them when you reboot.
echo "" > /etc/issue
echo "$R" >> /etc/issue
echo "Kernel $(uname -r) on $a $SMP$(uname -m)" >> /etc/issue

cp -f /etc/issue /etc/issue.net
echo >> /etc/issue
fi
touch /var/lock/subsys/local

fi


/usr/local/mysql/share/mysql/mysql.server start &

fi
/usr/local/apache/bin/apachectl start &

fi
--------------------------------------------------------------------------------


but the apache and mySQL did not start.
please help me!
 
Old 05-28-2001, 07:57 PM   #2
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
Looks to me like you have too many 'fi's in there... A fi closes an if. Just trying having your lines at the very end of the file. Also run it from the command line yourself and see what error(s) it gives you... Remember to call the correct shutdown somewhere for mysql too!!

Jamie...
 
Old 05-28-2001, 08:02 PM   #3
epic
Member
 
Registered: May 2001
Location: Shanghai,China
Distribution: Gentoo Linux 1.3b
Posts: 51

Original Poster
Rep: Reputation: 15
Angry How to call the correct shutdown for MySQL?

OK,thank you!apache and mySQL is up,
but How to call the correct shutdown for MySQL?
 
Old 05-28-2001, 08:10 PM   #4
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
Code:
mysqladmin -u root --password=somepassword shutdown
will work but it will mean putting a password in a script which isn't really a good idea if you have any interactive users on the machine. The better option is mentioned in the mysql manaual:

4.16.3 Starting and Stopping MySQL Automatically
The mysql.server script can be used to start or stop the server
by invoking it with start or stop arguments:
shell> mysql.server start
shell> mysql.server stop
mysql.server can be found in the `share/mysql' directory
under the MySQL installation directory or in the `support-files'
directory of the MySQL source tree.

HTH

Jamie...
 
Old 05-29-2001, 07:53 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,335
Blog Entries: 55

Rep: Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535
its better to centralize startup scripts in /etc/rc.d/init.d and then link em to the runlevel cuz it then also will work in tksysv and other apps that manage daemons. rc.local wasnt really ment for this, its not flexible.

--cut below
Code:
#!/bin/sh
# make it easy... choose one name:
#APP=/usr/local/mysql/share/mysql/mysql.server
#APP=/usr/local/apache/bin/apachectl
. /etc/rc.d/init.d/functions
case "$1" in
 start)
        $APP start &
        echo $(basename $APP) started
        ;;
   stop)
        # functions sourced makes we can use
        killproc $APP
        echo $(basename $APP) stopped
        ;;
restart)
        # since syntaxes differ we just do
        $0 stop
        $0 start
      *)
        echo "$0 [start|stop|restart]"
esac
--cut above


cut & past em as /etc/rc.d/init.d/msql and /etc/rc.d/init.d/httpd, the only thing to enable is the corresponding "APP" line.

now automagically start in runlevel 3:
Code:
ln -s /etc/rc.d/init.d/msql /etc/rc.d/rc3.d/S90msql
and
Code:
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S95httpd
plus stop on halt:
Code:
ln -s /etc/rc.d/init.d/msql /etc/rc.d/rc0.d/K10msql
one more
Code:
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc0.d/K15httpd
even tho i write these with my eyes closed, warnings still valid:
*take care with script that u havent written ureself
 
Old 09-04-2006, 09:44 PM   #6
anroy
LQ Newbie
 
Registered: Aug 2006
Location: Tokyo
Distribution: Gentoo, Xandros
Posts: 18

Rep: Reputation: 0
Thumbs up Apache and MySQL at system startup - SUCCESS!!

This is not meant to be a how-to, but I am just sharing my experience of something going smoothly, in case it helps anyone.

I installed MySQL, Apache and PHP from source tarballs.

Until now I have been starting MySQL and Apache manually everyday. It is a real pain. I had no idea how to make them start automatically but spent most of today investigating how to do this.

This worked on both my Xandros and Ubuntu 6.06 systems.

=========================================
MySQL
=========================================

-----------------------------------------
References Used
-----------------------------------------
http://www.adobe.com/devnet/dreamwea...cles/lamp.html
http://dev.mysql.com/doc/refman/5.0/...tic-start.html
http://dev.mysql.com/doc/refman/5.0/...ql-server.html
http://www.debian-administration.org/articles/28

-----------------------------------------
Changed in /etc/my.cnf (MySQL site)
-----------------------------------------
[mysqld]
user=mysql

-----------------------------------------
Set startup item (Dreamweaver site)
-----------------------------------------
# sudo cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
# sudo update-rc.d mysql defaults

Results of the update-rc.d command were as follows:

Adding system startup for /etc/init.d/mysql ...
/etc/rc0.d/K20mysql -> ../init.d/mysql
/etc/rc1.d/K20mysql -> ../init.d/mysql
/etc/rc6.d/K20mysql -> ../init.d/mysql
/etc/rc2.d/S20mysql -> ../init.d/mysql
/etc/rc3.d/S20mysql -> ../init.d/mysql
/etc/rc4.d/S20mysql -> ../init.d/mysql
/etc/rc5.d/S20mysql -> ../init.d/mysql


=========================================
Apache
=========================================

-----------------------------------------
References Used
-----------------------------------------
http://www.adobe.com/devnet/dreamwea...cles/lamp.html

-----------------------------------------
Set startup item (Dreamweaver site)
-----------------------------------------
# sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/apache
# sudo update-rc.d apache defaults

Results of the update-rc.d command were as follows:

Adding system startup for /etc/init.d/apache ...
/etc/rc0.d/K20apache -> ../init.d/apache
/etc/rc1.d/K20apache -> ../init.d/apache
/etc/rc6.d/K20apache -> ../init.d/apache
/etc/rc2.d/S20apache -> ../init.d/apache
/etc/rc3.d/S20apache -> ../init.d/apache
/etc/rc4.d/S20apache -> ../init.d/apache
/etc/rc5.d/S20apache -> ../init.d/apache


Also, for anyone struggling with installation / environment issues regarding LAMP (Linux/Apache/MySQL/PHP), this article at the Dreamweaver site, of all places, has to be one of the best resources I have found.
http://www.adobe.com/devnet/dreamwea...cles/lamp.html
 
  


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
reinstall mysql - now apache will not start raninix Linux - Newbie 2 11-23-2004 11:40 AM
How To make MySql and Apache start at boot time? umeshz Red Hat 1 05-18-2004 01:00 PM
MySql error 2002, Cannot start mysql djchris Linux - Software 5 04-13-2004 06:12 PM
Why Won't Apache and MySQL Start on Boot? John_Saunders Linux - Newbie 1 07-17-2002 12:23 AM
Start Apache when system boots up eweborg Linux - General 1 03-05-2002 12:37 AM


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