# mysqld_multi init script

## jeezus84

Good evening everybody.

I'm trying to write an init script that will start mysqld_multi with the proper sockets when I boot the computer. I've started to write a script, but when I go to run it, Gentoo tells me it has syntax errors.

```

root@linux_01 init.d # ./mysql-multi start

 * ERROR:  "./mysql-multi" has syntax errors in it; not executing...

```

Here is a copy of the script.

```

root@linux_01 init.d # cat ./mysql-multi

#!/sbin/runscript

depend() {

}

start() {

   mysqld_multi start 6,10,11,12,13,14,15,16

}

stop() {

   mysqld_multi stop 6,10,11,12,13,14,15,16

}

restart() {

   mysqld_multi stop 6,10,11,12,13,14,15,16

   mysqld_multi start 6,10,11,12,13,14,15,16

}

root@linux_01 init.d # 

```

What would I need to fix this script up? Thanks.

----------

## joeswift

this url may help  :Smile: 

http://man-wiki.net/index.php/1:mysqld_multi

----------

## jeezus84

thanks, but no cigar. That page only tells one how to use the command to start the server, and I already knew that. My problem lies in the syntax of my init script. I've never written an init script before, but I've read a couple tutorials and what I have looks right to me. Apparently not to Gentoo though. If someone could tell me what's wrong with my script I'd be eternally grateful. Thanks.

----------

## cornet

You're in luck.

Just done this myself. Note that you don't need the restart function, /etc/init.d/mysql restart "just works"  :Smile: 

```

cowtest init.d # cat mysql 

#!/sbin/runscript

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-4.0.24-r2.rc6,v 1.1 2005/05/17 09:08:46 robbat2 Exp $

depend() {

        use dns net

}

MY_CNF=/etc/mysql/my.cnf

start() {

        ebegin "Starting mysqld (${MY_CNF})"

        mysqld_multi --config=$MY_CNF start

        eend 0

}

stop () {

        ebegin "Stopping mysqld (${MY_CNF})"

        mysqld_multi --config=$MY_CNF stop

        eend 0

}

```

Cornet

----------

