d11wtq
d11wtq

Reputation: 35318

Execute a command as sudo from within a rake task?

Other than hard-coding "sudo" into the exec/system argument string, is there a flag in Rake that specifies that a command needs to be executed with root privileges, and will prompt for a password if needed? Like how Babushka has a :sudo => true option.

Upvotes: 2

Views: 1547

Answers (1)

Andrea Pavoni
Andrea Pavoni

Reputation: 5311

don't know if there's a Rake option for this (but I suppose there isn't). you can easyly do it by checking user's privileges. check this answer:

On Unix, find if user who executed the program is root?

Upvotes: 1

Related Questions