Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a service/daemon that won't start from boot.
I have used the chkconfig --add <script name> command that went ok
I also used the chkconfig <script name> on and that seems to be fine and I have made the script executable Chmod 777 <filename>. By all account it looks like the script is running at boot the the services has not started. When I do a ps -ef | grep ndb_mgmd this process is no there. the script can be run from the console and sems to run fine! can anyone shed some light on this. here is my script.
#!/bin/bash
# chkconfig: 345 70 30
# description: MySQL Cluster management server start/stop script
echo hello Paul >> /tmp/hello.txt
configdir=/var/lib/mysql-cluster/
configini=$configdir/config.ini
managementnodeid=1
portnumber=1186
initial=
AFAIK, you have to double quote variables to expand them into their contents, so configini=$configdir/config.ini is probably not being defined properly either.
The /usr/sbin/ndb_mgmd command will run just fine without a surrounding $( ) and will not run with its arguments enclosed in double quotes as in "$configini --ndb-nodeid=$managementnodeid $initial --configdir=$configdir" because that will pass a single argument instead of several words.
And there is no need to double quote variables to expand them into their contents. If they contain embedded whitespace it may be necessary to avoid them being split into words at the whitespace but not when they are on the RHS of an assignment as in configini=$configdir/config.ini. It would work as configini="$configdir/config.ini" but such double quoting is not necessary.
@jgonsalves: IDK the ndb_mgm command but "$managementnodeid stop" is unusual; does it really need to be a single word? Should it not be "$managementnodeid" stop ? If so it's surprising that the script works when "run from the console". Are you 100% sure it works then?
Thanks for the replies Guys but none of your suggestions worked. This script was copied from a duplicate server that seems to work fine and I can start and stop the script from the console. Iam running this on a Fedora 11 build. although I do think it's something to do with the script.
Last edited by jgonsalves; 05-26-2010 at 06:55 AM.
Reason: add more info
Run with the start call
[root@UKLX-PRMGM ~]# /etc/init.d/ndb_mgmd start
2010-05-26 13:20:32 [MgmtSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.39 ndb-7.0.9b
2010-05-26 13:20:32 [MgmtSrvr] INFO -- Loaded config from '/etc/mysql/ndb_1_config.bin.1'
[root@UKLX-PRMGM ~]#
Run with the stop call
[root@UKLX-PRMGM ~]# /etc/init.d/ndb_mgmd stop
Connected to Management Server at: 127.0.0.1:1186
Node 1 has shutdown.
Disconnecting to allow Management Server to shutdown
it all seems to working fine from the console but won't start up from boot
Last edited by jgonsalves; 05-26-2010 at 07:31 AM.
Reason: extr info
Thanks for the replies Guys but none of your suggestions worked. This script was copied from a duplicate server that seems to work fine and I can start and stop the script from the console. Iam running this on a Fedora 11 build. although I do think it's something to do with the script.
OK.
When you write "it looks like the script is running at boot", what happens? Presumably /tmp/hello.txt is populated with "hello Paul" and "start" -- and you are confident those were written during boot, not during some previous testing (might be helpful to add /usr/bin/date >> /tmp/hello.txt before echo hello Paul >> /tmp/hello.txt).
In which case, if you get "start" in /tmp/hello.txt you are confident that the start function has run. The only effective line in the start function is $STARTMGM so we can focus on that. Perhaps that has a different value when run as a boot script and when run interactively (it's hard to see how but we've nothing else to work on). If not there is something about the process environment which the command runs in which is different.
How about adding some debugging to the start function?
Code:
for word in $STARTMGM
do
echo "'$word'" >> /tmp/hello.txt
done
env >> /tmp/hello.txt
$STARTMGM &>> /tmp/hello.txt
/usr/bin/ps -ef | /usr/bin/grep -v grep | /usr/bin/grep ndb_mgmd >> /tmp/hello.txt
Then you could remove /tmp/hello.txt, run the script from a command line, rename /tmp/hello.txt, boot and then compare the new /tmp/hello.txt with the renamed one.
I2010-05-26 13:07:19 [MgmtSrvr] INFO -- NDB Cluster Management Server. mysql-5.1.39 ndb-7.0.9b
2010-05-26 13:07:19 [MgmtSrvr] INFO -- Loaded config from '/etc/mysql/ndb_1_config.bin.1'
2010-05-26 13:07:19 [MgmtSrvr] ERROR -- The hostname this node should have according to the configuration does not match a local interface. Attempt to bind '192.168.202.232' failed with error: 99 'Cannot assign requested address' think I have found the problem I had A look in the boot log and found this:
I will try to put a sllep command in the csript to allow the ipaddress to be configured. unless you can give me a better alternative.
Thanks for your help chaps I have put a 5 second sleep command in the script giving the system time to get an IP address and the process now come up at boot.
Putting a sleep in the script will certainly delay the boot and will not fix the problem if the boot script that sets up the IP requirements runs after this one.
You could change the # chkconfig: 345 70 30 line to # chkconfig: 345 98 01 (I think that is the right way round for a late start and early finish) and then run chkconfig to remove the old and run it again to add the new. With a bit of luck that will result in the script running late enough in the boot process for the IP to have been configured.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.