how can i test if my shell script was run directly by SMF or directly by user
how can i test in my shell script if my shell script was run by SMF or directly by user i want to block users running my start shell sc开发者_如何学运维ript while allowing only SMF to run it and if a user tries to run it directly to tell it it should run it with svcadm nice message...
thanks
Is it really SMF vs user or is it interactive vs non-interactive? (Unfortunately, I don't know much about SMF - it was init/.rc files in my day.)
http://tldp.org/LDP/abs/html/intandnonint.html
35.1. Interactive and non-interactive shells and scripts
... If a script needs to test whether it is running in an interactive shell ...
Probably you could check the caller's id
? Or play with permissions, allowing only a certain user to run it.
精彩评论