rc.httpd and rc.mysqld break startup scripts
Hello fellow slackers,
On my SW12.1 box I am trying to get both httpd and mysqld to startup on boot. However, they are mutually destructive with respect to their startup routines. And it does not matter whether I have them listed in rc.inet2 or rc.M or rc.local - either way the first guy will kill the rest of the startup chain. Both scripts have Code:
exit 1 Code:
exit 0 My initial thought was to comment out the various exit statements in both scripts. This proves to be fishy business because rather than exiting prematurely on an error (or success), the script continues to chew through its remaining lines, which screws things up. The thought just occurred to me (writing this during a MIPS assembly language class talking about jumps and such) that I should probably create a label at the end of the file and rather than exit, just "jump to the end." I'll try this later, but hopefully this is the end of the line for me. I haven't had this problem before on my LAMP setups, so I wonder a bit if it should be this much work... any thoughts appreciated. |
Is MySQL initialized?
Rather than being 'mutually destructive' it sounds more like MySQL has not been initialized yet. Did you run mysql_install_db or otherwise set up the initial database?
See the comments at top of /etc/rc.d/rc.mysqld. If you have already done this how about a little more info on your setup. |
Nether rc.httpd or rc.mysqld have any exit in them and both of them are already sourced from rc.M.
All you have to do is make the rc.* files executable and they will be ran. As far as the exit making the parent script end it depends on if it was sourced into the calling script or if it was "ran" and how the shell has been configured. |
3 Attachment(s)
the last lines of /etc/rc.d/rc.M:
Code:
# Start the MySQL database: XGizzmo, you were suggesting that if I replaced the line that said Code:
. /etc/rc.d/rc.httpd start Code:
/bin/sh /etc/rc.d/rc.httpd start |
What do you get if you try to start mysql after you boot?
As root, (assuming /etc/rc.d/rc.mysqld is executable) Code:
/etc/rc.d/rc.mysqld start |
Each script starts its respective server on its own with no errors - works beautifully, it's just that anything I try to start after them (including the other one) is screwed.
For your amusement, this is what I get (just now): Code:
xxx@xxx:xxx$ sudo /etc/rc.d/rc.mysqld start Code:
Starting MySQL. SUCCESS! I moved the two server startup blocks to rc.local for testing just now, and changed the ". " invocation to a full "/bin/sh" invocation, hoping for a forked shell that can absorb the extra "exit" and return to hit the next one the same way: Code:
# Start the MySQL database: Code:
xxx@xxx:/etc/rc.d$ sudo ./rc.local |
Quote:
Anyway, glad you got it going. |
Quote:
Is there a reason why you are not using Slackware's scripts? Eric |
A quick perusal of rc.M seems to show some of the called subsystem rc scripts are sourced in and some are called with their own shell process..
Wouldn't it just be better to spawn new shells for all of the subsystem scripts and reduce the chance of possible cross contamination or other errors from customised subsystem scripts? Though sourcing as much as possible may provide some small performance gain during startup, wouldn't the consistency and resilience of spawning a new shell for each of them be worth any additional cost in overhead? |
Quote:
|
AlienBob:
rc.mysqld is a symlink to /usr/local/share/mysql/mysql.server, which is the provided shell script for starting the mysql server, and is init-script-compliant (rc.mysqld start works) except for the fact that it exits. Thus it is not an official Slackware script. rc.httpd I believe I wrote myself, following the example of other basic init scripts using the simple Bash case...esac structure. This calls apachectl, as you have seen, and that is where the exit occurs. GazL: I did not write the remainder of rc.M - the default behavior was to source all subsequent rc scripts as they were - I see now that this may be the safest procedure... |
Quote:
|
Quote:
|
Quote:
|
Quote:
Code:
sed -e 's:\. /etc/rc.d/rc.:/bin/sh /etc/rc.d/rc.:g' /etc/rc.d/rc.M |
All times are GMT -5. The time now is 09:43 PM. |