开发者

how can i test if my shell script was run directly by SMF or directly by user

开发者 https://www.devze.com 2023-02-08 16:38 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消