William James wrote:
On 3/7/07, Darren J Moffat <[EMAIL PROTECTED]> wrote:
William James wrote:
> This is not correct.
> Writing a SMF plug in FORCES me to use /bin/sh.
If by plug you mean SMF method script your statement is WRONG.
No it is not. You're wrong. Put /usr/bin/ksh into a SMF script and it
will not be executed.
Are you telling me that I'm wrong that the method script for the
cryptosvc SMF service is NOT a shell script ?
Hmn lets see:
islay:pts/2$ svcprop -p start/exec cryptosvc
/usr/sbin/cryptoadm\ %m
islay:pts/2$ ls -l /usr/sbin/cryptoadm
-r-xr-xr-x 1 root bin 80612 Dec 3 18:51 /usr/sbin/cryptoadm*
islay:pts/2$ file /usr/sbin/cryptoadm
/usr/sbin/cryptoadm: ELF 32-bit LSB executable 80386 Version 1 [FPU],
dynamically linked, not stripped, no debugging information available
It is a BINARY so SMF does not require you to use a shell script! Which
is what I said.
Also I have successfully used #!/usr/bin/ksh with an SMF method script.
I have a locally installed SMF service called svc://site/volume, that
has /lib/svc/method/volume as its start method, that script starts with
#!/usr/bin/ksh.
To recheck that I added a simple ptree $$ to the top of the script and
looked at the log and guess what I got:
7 /lib/svc/bin/svc.startd
588 /usr/bin/ksh /lib/svc/method/volume
589 ptree 588
So it sure looks to me like /usr/bin/ksh just works.
This is Solaris Express Community Edition build 54.
Take for exampke the SMF method script for the svc:/system/cryptosvc
FMRI it isn't even a script but a compiled binary.
SMF does NOT require you to use any specific shell nor does it even
require that the method script be a shell script at all, there are
several that are in fact binaries. For example everything that is
started by the SMF delgated restarted svc.inetd is in fact a binary.
> Writing a script for /etc/init.d FORCES me to use /bin/sh
That one I'll give you the default is /bin/sh even via SMF.
However you can easily work around that by having the init.d script be
something very simple that runs the more complex script that actually
needs to be written with functionality that /bin/sh doesn't understand.
Not true, again it doesn't even have to be a shell script unless it ends
in .sh.
It will always use /bin/sh and ignores what you use as #! line in a
script. Files ending in .sh will be inlined (which is good since you
can set environment variables without using /etc/profile. SMF can't do
that).
You set the environment variables of a given service using the setenv
option of svccfg.
> Changing /etc/profile FORCES me to make it /bin/sh compatibleu
Then make your bash specific changes in /etc/bash.profile, your zsh ones
in /etc/zprofile. That is EXACTLY why these shells have their own named
profile variants.
So you think /etc/profile is only for /bin/sh?
That is what it was originally defined to be for, that fact that some
other later introduced shells also use it means that while you still
have a reall Bourne shell on the system that gets used you should only
put Bourne shell syntax in there.
--
Darren J Moffat
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code