Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using Debian Etch and I have following this and tried to write a script like this to auto start mysql server at boot:

#! /bin/sh
# /etc/init.d/blah
#

# Some things that run always
sudo /etc/init.d/mysql start

I used update-rc.d also, but mysql server don't start at boot, why?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

There's no reason for you to write this script. /etc/init.d/mysql is an init(1) script, so just use that:

# update-rc.d mysql defaults

If that doesn't work, you might need to look into the more advanced update-rc.d options. For instance, maybe you are using an uncommon runlevel, and the default runlevels for the provided mysql script don't include that.

If you were actually trying to get something to run on startup which doesn't already provide an init script, you'd need to remove the sudo bit. init scripts run as root already. You actually have to drop permissions if you need your program to run as another user.

share|improve this answer
    
for some unknown reason this always has stated: insserv: warning: current start runlevel(s) (3) of script 'mysql' overwrites defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 4 5 6) of script 'mysql' overwrites defaults (0 1 6). I had to update-rc.d mysql remove and then do update-rc.d mysql defaults this fixes it. If you want to know which runlevel youre running use who -r –  P.scheit Jun 5 at 6:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.