Notes |
|
(0005991)
|
bonivart
|
2009-04-21 17:17
|
|
Isn't this normally handled by the start script? Something like:
[ -f someconffile ] && startservice |
|
|
(0005997)
|
yann
|
2009-04-21 21:12
|
|
The script already has this check, but as your script will always try to enable the service (if autoenable_daemons != no), the init script will exit and the imapproxy service will go in maintenance mode from SMF point of view.
It would be cleaner to have it not started at all at the first install. |
|
|
(0006125)
|
yann
|
2009-05-17 16:57
|
|
Hi Peter,
Any news of this feature request ? |
|
|
(0006211)
|
bonivart
|
2009-05-28 10:24
|
|
I think I will enable this via another tweak in the init script. OK? |
|
|
(0006214)
|
bonivart
|
2009-05-28 14:44
|
|
|
|
(0006240)
|
skayser
|
2009-06-01 17:37
|
|
Thanks for adding this feature, just tested it and ran into a small hitch. The tr used to translate from upper to lower, doesn't work with multibyte locales and thus the script fails when running in for example en_US.UTF-8. Also there is a space missing in one of the test clauses.
# pkgparam CSWcswclassutils VERSION
1.14,REV=2009.05.29
# locale
LANG=
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
# pkgutil -t http://mirror.opencsw.org/opencsw/testing [^] -u stunnel
...
Creating service script in /var/opt/csw/svc/method/svc-cswstunnel ...
Creating manifest ...
Configuring service in SMF ...
CSWstunnel is using Service Management Facility. The FMRI is svc:/network/cswstunnel:default
Bad string
/usr/sadm/install/scripts/i.cswinitsmf: test: ] missing
Transcript of the last part with set -x enabled:
AUTOENABLE=yes
+ grep ^#AUTOENABLE /etc/opt/csw/init.d/cswstunnel
+ [ #AUTOENABLE no ]
+ grep ^#AUTOENABLE /etc/opt/csw/init.d/cswstunnel
+ awk {print $2}
+ tr -s [:upper:] [:lower:]
Bad string
AUTOENABLE=
+ [ yes = yes -a != no -a != false]
/usr/sadm/install/scripts/i.cswinitsmf: test: ] missing
Note the "Bad string" warning and the empty AUTOENABLE afterwards. test complains because there is a space missing before the closing bracket.
When using /usr/xpg4/bin/tr in i.cswinitsmf instead of /bin/tr, installation works fine. See also tr(1).
Note: /usr/bin/tr supports character class
expressions only in singlebyte locales. Use
/usr/xpg4/bin/tr to support these expressions
in any locale. |
|
|
(0006246)
|
bonivart
|
2009-06-02 19:17
|
|
|
|
(0006252)
|
skayser
|
2009-06-03 01:10
|
|
Works, thanks. What do you think about somehow evaluating the AUTOENABLE for classic init scripts also? From looking at the script, for $smf = no it will say "Starting $service" and try to run /etc/init.d/$service.
Taken stunnel, it doesn't make sense to run it without a proper configuration, that's why i use AUTOENABLE. Currently I have added a test -f conffile || exit 0 to its init script, but i was thinking about extending it with an error message like "stunnel configuration missing. Exiting.". Only with i.cswinitsmf this won't be seen by the user.
# grep -n "/etc/init.d/\$service start" /usr/sadm/install/scripts/i.cswinitsmf
298: /etc/init.d/$service start > /dev/null 2>&1
So if you could skip the /etc/init.d/$service start if AUTOENABLE says so, we would just have to make sure that our init scripts let users know why they bail out (like with the missing configuration). This way, upon reboot they would know why a service could not be started, but they wouldn't get a "Starting $service" with no immediate effect upon installation (like it is now). |
|
|
(0006257)
|
bonivart
|
2009-06-03 10:47
|
|
I thought about it but I would have to choose between just skipping the start at end of install or not creating the rc-links and skipping start. The first would seem clean at install but after a reboot it would try to start it again, is that ok? The second would perhaps be ok at first but after the user has fixed the config they would have to create the rc-links themselves which is not very nice.
It's hard to implement it perfectly without the knowledge of state that SMF brings to the table.
What do you think? |
|
|
(0006258)
|
skayser
|
2009-06-03 12:03
|
|
"The first would seem clean at install but after a reboot it would try to start it again, is that ok?"
IMHO yes and you are right, definitely better than not creating the rc links.
Maintainers just need to make sure that their init scripts throw a meaningful warning when the service can't be started (config missing or similar), should be documented in the cswclassutils wiki, then the start attempt after reboot doesn't harm at all. |
|
|
(0006259)
|
bonivart
|
2009-06-03 13:53
|
|
|
|
(0006264)
|
bonivart
|
2009-06-04 10:55
|
|
I have tested it with smf_test 2.8 and it works. |
|
|
(0006268)
|
bonivart
|
2009-06-04 18:51
|
|
Fix in 1.16 released today. |
|