Bug #38607 Write-protected log file causes init script to fail
Submitted: 6 Aug 2008 18:37 Modified: 8 Jul 19:09
Reporter: Kay Roepke
Status: Verified
Category:Monitoring: Agent Severity:S3 (Non-critical)
Version:1.3, 2.0 OS:Any
Assigned to: Kay Roepke Target Version:2.01 maint release
Tags: startup script, Agent
Triage: D4 (Minor) / R3 (Medium) / E3 (Medium)

[6 Aug 2008 18:37] Kay Roepke
Description:
If the agent's log file is write-protected the init.d script fails to notice the early
exit of the agent.
It will wait until the startup timeout elapsed (default: 120 seconds) rather than exit
immediately.
There is not indication of what the error was.

How to repeat:
Remove the write permission from the log file and start the agent using the supplied
init.d script.

Suggested fix:
The startup script should redirect STDERR and check the return code from the agent
process in addition to waiting for the PID file to appear.
[6 Aug 2008 18:39] Kay Roepke
Possibly the same underlying issue as Bug#37108
[11 Aug 2008 13:56] Kay Roepke
Fixed in revision 970.
The init script now checks the return value of the executable (should be 0 if it
daemonize worked correctly) and displays STDERR of the executable.
Otherwise all messages go to the logfile, if writable.
[11 Aug 2008 13:58] Kay Roepke
Not fixed in 1.3.x yet
[11 Sep 2008 23:42] Diego Medina
tested 2.0.0.7049 and it has not been fixed

==================

I chmod 000 the log file:

[$] ll  /Applications/mysql/enterprise/agent/mysql-monitor-agent.log 
----------  1 wizard  admin  785937 Sep 11 17:04
/Applications/mysql/enterprise/agent/mysql-monitor-agent.log

And then I run

/Applications/mysql/enterprise/agent/etc/init.d/mysql-monitor-agent start

and the script just sits there, showing the dots until the timeout (120 seconds)
[10 Oct 2008 17:58] Diego Medina
This would normally happen at least on cases where the agent is installed under one user
(root as as example) and then you try to run it as another user.

The default permissions on the file are:

-rw-r----- 1 root root 29553825 2008-10-10 08:24 mysql-monitor-agent.log

when installing it on linux as root.

It would be nice it you get an error right away, instead of having to wait for 2 minutes.