script in autostart of opensuse 11.2?

Hi everybody,

I’m not sure if this is the right sub-forum, but I hope so.

I recently installed mysql-cluster on my servers and now I want to put some commands into the autostart to make things easier.
I use commands like “ndbd” or “ndb_mgmd” to start the services but I think it would be easer if this happens automatically at the system start or login.

I already managed to put mysql into the autostart with “chkconfig mysql on” but this doesn’t work with the other services I mentioned.

In another thread I read that it would be possible to create a script containing the commands and put it into the autostart-folder. As folder they used something like /home/user/.kde/autostart but I don’t have any similar folder. What do I have to use then?

Thanks in advance,
Yukari

/home/user/.kde/autostart

should be

/home/user/.kde/Autostart Don’t miss that upper case A :wink:

There are neither a .kde nor a Autostart folder, or do I have to create them first?

It’s there. :wink:

The . before kde makes it a hidden folder. You have to tell the system to show hidden files and folders.

Are you on KDE, KDE4 or GNOME?

for KDE (aka KDE3), it’s /home/user/.kde/Autostart
for KDE4, it’s /home/user/.kde4/Autostart
for GNOME… no clue, I don’t use it

Erm, I think it should be KDE4

And well… maybe I’m blind but I switched on hidden files and also tried it with the console:
http://img5.imagebanana.com/img/vi9wkev/thumb/snapshot2.png](http://img5.imagebanana.com/view/vi9wkev/snapshot2.png)

That’s why I always wondered about the many threads where the folder you mentioned is told… I seem to don’t have it :open_mouth:

Hi
Are these services that need to be run by the user or mysql/root? If
they are in the latter, you need to look at using
the /etc/init.d/skeleton as it’s a template for adding services to
start during boot.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.37-0.1-default
up 3 days 23:08, 2 users, load average: 0.01, 0.04, 0.06
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

That’s because you’re logging in as root, unless you have a very, very good reason(Unlikely) then there is no reason to.

AFAIK even a server should run with the least privileges. If this is gui-less then I would suspect the advice given by malcomlewis is the way to go.

Edit
Mmm looking over it some presumption on my behalf I’m wrong but still relates to the user, dbserver1 user looks like they haven’t logged in to the gui. Got confused by the dir listing as root.

Mh, I logged in with the user I created at installation and tried to start the service but it didn’t work, so I assume that root is required.

I looked into that skeleton you mentioned, but… it’s huge :open_mouth: …and I’m a newbie :confused:

Maybe I have to read it slowly to understand it, but maybe you could give me a hint how to use it in this case?

I’ve not looked but if this a suse rpm I’m surprised you don’t already have an init script. The other way to do this would be with sudo yes I do suspect this is related to root permissions, but dbserver1 won’t have them either.

I was going to check but I see an rpm for it but only 11.2(11.1 here), does it really not show a runlevel choice, or is there perhaps a config?

What I’m saying is I’m surprised there is a need to write a init script for a suse rpm.

So if this is really needed then you have 2 ways either use a sudo command but be aware of the security implications, or create an init script. I can’t help as I’ve not done it but the skel should be a start then also look at some of the others. I thought there was also a page on the wiki but I couldn’t find but only briefly looked.

#!/bin/bash

### BEGIN INIT INFO
**# Provides:		some_name**
# Required-Start:	$network $remote_fs $mysql
# Required-Stop:	$null
# Default-Start:	2 3 5
# Default-Stop:		0 1 6
# Description:		Start additional ndbd and ndb_mgmd services
### END INIT INFO

# Include status script
. /etc/rc.status
rc_reset

case "$1" in
	start)
	echo -n "Starting services ndbd and ndb_mgmd"
	**<YOUR SERVICE START CODE GOES HERE>**
	rc_status -v
	;;
	stop)
	echo -n "Shutting down services ndbd and ndb_mgmd"
	**killproc -G -TERM /path/to/ndbd**
	rc_status -v
        **killproc -G -TERM /path/to/ndbd_mgmd**
        rc_status -v
	;;
	try-restart|condrestart)
	# Restart only if program is running
	$0 status
	if  $? = 0 ]; then
		$0 restart
	else
		rc_reset
	fi
	rc_status
	;;
	restart)
	$0 stop
	$0 start
	rc_status
	;;
	reload|force-reload)
	echo -n "Reloading services ndbd and ndb_mgmd"
	**killproc -G -HUP /path/to/ndbd**
	rc_status -v
        **killproc -G -HUP /path/to/ndb_mgmd**
        rc_status -v
	;;
	status)
	**echo -n "Checking status of service ndbd"
	checkproc /path/to/ndbd
	rc_status -v
        echo -n "Checking status of service ndb_mgmd"
        checkproc /path/to/ndb_mgmd**
        rc_status -v
	;;
	*)
	echo "Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|status}"
	exit 1
	;;
esac 
rc_exit

Tweak/modify/improve/etc the ones in bold, then copy script to /etc/init.d and do chkconfig -a <name_of_script> (without < and >, of course, just the name)

Yukari-chan wrote:
> so I assume that root is required.

-welcome-

ample documentation for Linux is available, so you need not resort to
either assuming or guessing how to set up or administer a cluster of
mysql servers…

first, most experienced administrators would tell you that you should
not be running KDE, GNOME or any other GUI on a cluster of servers…

therefore you should not have /home/user/.kde, despite the fact that
others here are sure just overlooked it…

> Maybe I have to read it slowly to understand it, but maybe you could
> give me a hint how to use it in this case?

first tell us, do you want to run a cluster of headless enterprise
level servers without X-Windows or do you want to run it like most
folks run their Redmond machines?


palladium

I tried the solution of microchip8 for the ndbd-service and it seems to work! (but not yet for the ndb_mgmd)
Unfortunately I’m leaving here and will be heading home for today, but tomorrow I’ll be here again (what isn’t meant as a threat :wink: ) when I’ll have more time to answer your posts in detail.
So, see(read) you tomorrow :slight_smile:

Post your script :wink:

Hello everyone again,

here are my answers to your previous posts as promised yesterday:

One question first: what is sudo?
And to YOUR questions: actually I’ve got no idea what you mean, sorry :frowning:

Yes, I partially solved it with skeleton now. (see quotes at the end of this post)

a) Well, I’m doing my best ^^" I just tried to start the service with another user, then it said:
“Absolute path to ‘ndbd’ is ‘/usr/sbin/ndbd’, so running it may require superuser privileges (eg. root).”
That’s why I thought, root is required.

b) Is there a reason for that? What makes the huge difference between a system with and without a GUI? I think I would be able to use a system without a GUI but for me as a newbie it’s much easier to have things more “obious”, that’s why I installed it that way.

c) Ah, ok… I already wondered about it.

d) Sorry, I have no clue what you’re asking me, respectively what you want to hear from me :frowning:

Here’s the script I’m using for the ndb_mgmd-service on one host and what isn’t working, yet:

#!/bin/bash

### BEGIN INIT INFO
# Provides:		ndb_mgmd
# Required-Start:	$network $remote_fs $mysql
# Required-Stop:	$null
# Default-Start:	2 3 5
# Default-Stop:		0 1 6
# Description:		Start additional ndb_mgmd service
### END INIT INFO

# Include status script
. /etc/rc.status
rc_reset

case "$1" in
	start)
	echo -n "Starting service ndb_mgmd"
	ndb_mgmd
	rc_status -v
	;;
	stop)
	echo -n "Shutting down service ndb_mgmd"
	killproc -G -TERM /usr/bin/ndb_mgmd
	rc_status -v
	;;
	try-restart|condrestart)
	# Restart only if program is running
	$0 status
	if  $? = 0 ]; then
		$0 restart
	else
		rc_reset
	fi
	rc_status
	;;
	restart)
	$0 stop
	$0 start
	rc_status
	;;
	reload|force-reload)
	echo -n "Reloading service ndb_mgmd"
	killproc -G -HUP /usr/bin/ndb_mgmd
	rc_status -v
	;;
	status)
	echo -n "Checking status of service ndb_mgmd"
	checkproc /usr/bin/ndb_mgmd
	rc_status -v
	;;
	*)
	echo "Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|status}"
	exit 1
	;;
esac 
rc_exit 

Here’s the script I’m using for the ndbd-service on two hosts and what is working fine:

#!/bin/bash

### BEGIN INIT INFO
# Provides:		ndbd
# Required-Start:	$network $remote_fs $mysql
# Required-Stop:	$null
# Default-Start:	2 3 5
# Default-Stop:		0 1 6
# Description:		Start additional ndbd service
### END INIT INFO

# Include status script
. /etc/rc.status
rc_reset

case "$1" in
	start)
	echo -n "Starting service ndbd"
	ndbd
	rc_status -v
	;;
	stop)
	echo -n "Shutting down service ndbd"
	killproc -G -TERM /usr/bin/ndbd
	rc_status -v
	;;
	try-restart|condrestart)
	# Restart only if program is running
	$0 status
	if  $? = 0 ]; then
		$0 restart
	else
		rc_reset
	fi
	rc_status
	;;
	restart)
	$0 stop
	$0 start
	rc_status
	;;
	reload|force-reload)
	echo -n "Reloading service ndbd"
	killproc -G -HUP /usr/bin/ndbd
	rc_status -v
	;;
	status)
	echo -n "Checking status of service ndbd"
	checkproc /usr/bin/ndbd
	rc_status -v
	;;
	*)
	echo "Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|status}"
	exit 1
	;;
esac 
rc_exit 

I’ve got no clue why one script is working and another isn’t because there isn’t much difference between them…

Btw. is there a possibility to log the events coming from the script/starting service?

Yukari-chan wrote:

> One question first: what is sudo?

when as a normal user logged into a GUI (like KDE, GNOME) or at the
command line (without X running any windows at all) and you need to
use root/super user powers there are several ways to do that…

one is to type su either at the command line you are already at, or
by launching a terminal in a window and typing in su there, and
hit enter, it will ask for a password and if you type correctly you
will “become root” in that terminal…

su is a command, it is short for Switch User…if you go to a command
line and type man su you will see the MANual for Switch User…

if you just type su you will be using root powers but with the path
and other environment of you, a user…

if you type su - you will become root with root’s path and
environment…

in either case you will REMAIN root until you type exit and hit
enter, in which case you become you again, OR you can type

su - [any user] and become THAT user (if you know their password)

ok, all of that to get to your question:

sudo is a command to let you run something else AS root, and when that
something is done you automatically revert back to you…

like

sudo cat /etc/fstab

lets cat read and disply fstab AS ROOT, and then immediately releases
root powers…

>> a)
>> ample documentation for Linux is available, so you need not resort to
>> either assuming or guessing how to set up or administer a cluster of
>> mysql servers…
>>
>> b)
>> first, most experienced administrators would tell you that you should
>> not be running KDE, GNOME or any other GUI on a cluster of servers…
>>
>> c)
>> therefore you should not have /home/user/.kde, despite the fact that
>> others here are sure just overlooked it…
>>
>>
>>> Maybe I have to read it slowly to understand it, but maybe you could
>>> give me a hint how to use it in this case?
>> d)
>> first tell us, do you want to run a cluster of headless enterprise
>> level servers without X-Windows or do you want to run it like most
>> folks run their Redmond machines?
>>
>
> a) Well, I’m doing my best ^^" I just tried to start the service with
> another user, then it said:
> “Absolute path to ‘ndbd’ is ‘/usr/sbin/ndbd’, so running it may require
> superuser privileges (eg. root).”
> That’s why I thought, root is required.

but you do NOT have to log into KDE/GNOME/etc as root to do
that…most experienced folks will tell you to not log into
KDE/GNOME/etc as root because so many different things can go sour
that way…

instead, i always log in as a simple user and “become root” at the
command line (with su, su -, or sudo) or in a root powered GUI app
(like “file manager Super User mode” or YaST)–only!

> b) Is there a reason for that? What makes the huge difference between a
> system with and without a GUI? I think I would be able to use a system
> without a GUI but for me as a newbie it’s much easier to have things
> more “obious”, that’s why I installed it that way.

just that server functions (web servers, ftp servers, mysql servers,
print servers…whatever) do not need to have X-Windows running or
even installed…

if you want to administer a server from a window you may do that using
(for example) WebMin <http://en.wikipedia.org/wiki/Webmin> without
wasting CPU cycles on drawing unneeded windows on your server

> c) Ah, ok… I already wondered about it.
>
> d) Sorry, I have no clue what you’re asking me, respectively what you
> want to hear from me :frowning:

you said you “installed mysql-cluster on my servers” i suppose that
means you are serving up a database to a number of users…if so, you
can save a lot of money on monitors, and energy wasted on drawing
unneeded windows that no one need look at if you use the cluster as
“headless”, that is without either a monitor or X-Windows installed or
used…

i don’t know what you do with the cluster, but if it is to make money
you are probably gonna be way ahead by doing a lot study…maybe even
purchase/use SUSE Linux Enterprise Server instead of openSUSE, from
the level of your questions it seems you are gonna need the support
Novell can offer (not that you are not welcome to stay here…but, you
have to more self study, otherwise you are gonna spend a LOT of time
here…


palladium

Thank you very much for your detailled answer :slight_smile:

I think I understood now what sudo is. Then this could be an alternative to normally logging in as root. I’ll try that.

palladium wrote:
>just that server functions (web servers, ftp servers, mysql servers,
>print servers…whatever) do not need to have X-Windows running or
>even installed…

>if you want to administer a server from a window you may do that using
>(for example) WebMin <http://en.wikipedia.org/wiki/Webmin> without
>wasting CPU cycles on drawing unneeded windows on your server

Hm, I understand what you mean and truly makes sense… I’ll keep that in mind for later uses (when it’s going to the “real” system not only the test-system as it’s at the moment).

>you said you “installed mysql-cluster on my servers” i suppose that
>means you are serving up a database to a number of users…if so, you
>can save a lot of money on monitors, and energy wasted on drawing
>unneeded windows that no one need look at if you use the cluster as
>“headless”, that is without either a monitor or X-Windows installed or
>used…

Well, at the moment they aren’t physical servers, yet - maybe I should mention this. But they will be. At the moment I’m just testing everything I’ll need later on virtual servers using VMWare.
But I can calm you :wink: I won’t be the one who will be setting up the hardware. The “real” servers won’t have many monitors or stuff like that ^^ as far as I know I’ll be using them remotly but I can’t exactly tell at this time, because they’re not ready, yet.

>i don’t know what you do with the cluster, but if it is to make money
>you are probably gonna be way ahead by doing a lot study…maybe even
>purchase/use SUSE Linux Enterprise Server instead of openSUSE, from
>the level of your questions it seems you are gonna need the support
>Novell can offer (not that you are not welcome to stay here…but, you
>have to more self study, otherwise you are gonna spend a LOT of time
>here…

It’s my first project at my new job respectively as an apprentice here. I don’t know if there’s an option for a paid suse-version at the moment. But I’ve got about two month left for everything, so I’m still confident of being successful. In fact the mysql-cluster is only part of the project, but I hope that the time I’ve got is enough for everything.
I don’t mind if I have to spend a lot of time here or elsewhere just if I’ll get any benefit of it.

Mh, something else: are you maybe well versed with mysql-clusters? Sounded a little bit like it before.
(I don’t know if this is even grammatically correct or sais what I want to say - had to look up that sentence xD … well, my english still isn’t perfect - I hope you nearly understand what I mean)

> Mh, something else: are you maybe well versed with mysql-clusters?

you asking me?

> Sounded a little bit like it before.

sounded very little like it…

i’m a generalist knowing a little about a lot of stuff, but not a lot
about any stuff…

if you have some general questions that are openSUSE related, i’d
suggest you put something like “MySQL Cluster experience? help please”
in the subject line and post to the applications forum…

however if it is a MySQL Cluster question that would apply to any
Linux base, it probably is best asked in a forum where a bunch of
those gurus hang out [where that is i have no clue, but i bet google
knows], if you can’t find the answers already posted in (say):
http://dev.mysql.com/doc/


palladium