Page 1 of 1

URGENT - repair_database.sh failing - Permissions Denied

Posted: Fri Oct 21, 2016 1:41 pm
by krobertson71
Getting the following when trying to run ./repair_database.sh

Code: Select all

nagios@nagiasp01 scripts]$ ./repair_databases.sh 
mysqld (pid  10167) is running...
mysqld (pid  10167) is running...
DATABASE: nagios
TABLE:    
/usr/local/nagiosxi/scripts/repairmysql.sh: line 49: pushd: /var/lib/mysql/nagios: Permission denied
ERROR: Could not change to dir: /var/lib/mysql/nagios
mysqld (pid  10167) is running...
DATABASE: nagiosql
TABLE:    
/usr/local/nagiosxi/scripts/repairmysql.sh: line 49: pushd: /var/lib/mysql/nagiosql: Permission denied
ERROR: Could not change to dir: /var/lib/mysql/nagiosql
Stopping ndo2db: done.
Starting ndo2db: done.
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
Getting this error after a restart. Normally repairing the database works fine. Now I am getting this. Nothing has been changed in nagios. The directory /var/lib/mysql/nagios is owned by mysql|mysql.

Code: Select all

SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired SQL: SQL Error [ndoutils] : Table './nagios/nagios_servicestatus' is marked as crashed and should be repaired

Re: URGENT - repair_database.sh failing - Permissions Denied

Posted: Fri Oct 21, 2016 1:45 pm
by tgriep
The repair_database script has to be run as root. Login as root and then run the script, that should work for you.

Re: URGENT - repair_database.sh failing - Permissions Denied

Posted: Fri Oct 21, 2016 1:55 pm
by krobertson71
That I knew. Turns out the nagios user was removed from the "wheel". Once our linux team correct the scripts ran normally.

Thank you and sorry for the disturbance. They made that change without informing us so it was a stressful moment.

Re: URGENT - repair_database.sh failing - Permissions Denied

Posted: Fri Oct 21, 2016 1:59 pm
by dwhitfield
No problem. That's what we are here for. Can we go ahead and lock the thread?

Re: URGENT - repair_database.sh failing - Permissions Denied

Posted: Fri Oct 21, 2016 2:10 pm
by krobertson71
Sorry yes. You can lock it up.

Re: URGENT - repair_database.sh failing - Permissions Denied

Posted: Fri Oct 21, 2016 2:11 pm
by dwhitfield
Great, just wanted to be sure.