Jas
Jas

Reputation: 15113

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 script 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

Upvotes: 0

Views: 182

Answers (2)

Bert F
Bert F

Reputation: 87563

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 ...

Upvotes: 1

user332325
user332325

Reputation:

Probably you could check the caller's id? Or play with permissions, allowing only a certain user to run it.

Upvotes: 0

Related Questions