I'm trying to add a custom service to SMF's configuration, which seems successful in that the service starts and there is a log file, but therein lies the problem; the service, on start-up, prints some logging messages to the stderr. It seems that SMF is seeing those messages and, believing them to be errors, restarts the service, giving up after a number of tries and leaving the service off.
Here's part of the log output:
[ Mar 30 14:59:54 Enabled. ]
[ Mar 30 14:59:54 Executing start method ("java server.CustomServer"). ]
Starting server...
[ Mar 30 15:00:04 Method or service exit timed out. Killing contract 107. ]
Running the server directly on the commandline is fine, and AFACS there are no errors being encountered during startup, other than the output.
What would be the best way to manage this service with SMF? The logging is needed for diagnosing problems, and would be problematic to disable. Is it possible to configure this service to only restart if the service exists?
In checking the svc.startd man page, I'm not seeing stderr logging as a reason for failure. Check the SERVICE FAILURE section of the man page to help diagnose.
Based on the message you added, it looks like the start method is timing out. Is the service's start script putting that program ("java server.CustomServer") in the background so that it can exit?
It fails because your java program isn't started in the background. ‘smf(5)‘ expects the start method to return, and since yours doesn't it will hit the timeout.
You need to update the script to use