Services Sequence in rc.conf

Code:
May 20 14:25:22 nwtf-proxy01 snort[961]: FATAL ERROR: database: mysql_error: Can't connect to local MySQL server through socket
 '/tmp/mysql.sock' (2)

I got this error at boot. I notice that the snort service start first before mysql. But in my rc.conf is the sequence below.

Code:
# SQUID Configuration
# squid_enable="YES"

# MYSQL SERVICE 
mysql_enable="YES"

# SNORT Configuration
snort_enable="YES"

# WEB SERVICE 
apache22_enable = "YES"
apache22_http_accept_enable="YES"

How do I change the sequence so the system will first read the mysql and then the snort?

This is the sequence shown in rcorder:

Code:
rcorder: requirement `LOGIN' in file `/usr/local/etc/rc.d/squid' has no providers.
/usr/local/etc/rc.d/squid
rcorder: requirement `DAEMON' in file `/usr/local/etc/rc.d/snort' has no providers.
/usr/local/etc/rc.d/snort
rcorder: requirement `DAEMON' in file `/usr/local/etc/rc.d/snmptrapd' has no providers.
/usr/local/etc/rc.d/snmptrapd
rcorder: requirement `DAEMON' in file `/usr/local/etc/rc.d/snmpd' has no providers.
/usr/local/etc/rc.d/snmpd
rcorder: requirement `SERVERS' in file `/usr/local/etc/rc.d/pure-ftpd' has no providers.
rcorder: requirement `NETWORKING' in file `/usr/local/etc/rc.d/pure-ftpd' has no providers.
/usr/local/etc/rc.d/pure-ftpd
rcorder: requirement `LOGIN' in file `/usr/local/etc/rc.d/mysql-server' has no providers.

Please help.
 
The order in /etc/rc.conf is irrelevant.

Add the MySQL requirement to the snort rc file.
 
SirDice said:
The order in /etc/rc.conf is irrelevant.

Add the MySQL requirement to the snort rc file.

Thank you SirDice for the reply. I don't understand what you mean. But I did the changes below in the snort rc.d. I change the
Code:
mysql-server="YES"
to NO in rc.conf file.

Code:
# PROVIDE: snort
# REQUIRE: DAEMON mysql-server
# BEFORE: LOGIN
# KEYWORD: shutdown

"./usr/local/etc/rc.d/mysql-server onestart"

This is error is gone:
Code:
snort[961]: FATAL ERROR: database: mysql_error: Can't connect to local MySQL server through socket
 '/tmp/mysql.sock' (2)

I think my problem is solved. Any idea?
 
That's the wrong way to solve it. Look at the rc script for MySQL. Look at the remarks at the top, look for the "PROVIDE". Note what it says. Then edit the rc file for snort and add that to the list of "REQUIRE".

That should make sure MySQL is started before snort.
 
Yes, it's fine now. Here is the current order:

Code:
rcorder: requirement `LOGIN' in file `/usr/local/etc/rc.d/squid' has no providers.
/usr/local/etc/rc.d/squid
rcorder: requirement `LOGIN' in file `/usr/local/etc/rc.d/mysql-server' has no providers.
/usr/local/etc/rc.d/mysql-server
rcorder: requirement `DAEMON' in file `/usr/local/etc/rc.d/snort' has no providers.
 
Code:
/usr/local/etc/rc.d/mysql-server.sh

# PROVIDE: mysql
# REQUIRE: LOGIN
# KEYWORD: shutdown

So you should add

Code:
REQUIRE: mysql
to snort.sh.
 
Back
Top