I am issuing monit commands from command line and this works
$ sudo monit reload
Now I create a shell script monitreload.sh
#!/bin/bash
monit reload
And then the commands
$ sudo ./monitreload.sh
$ sudo -u ram ./monitreload.sh
The above ones fail with permission denied error.
Pls note /etc/monit/monitrc file is owned by root and the user 'ram' is a valid sudo user. Most of the questions in SO talk about gid and uid usage in monit config like this one or invoking a shell through monit config like this one
What is going wrong here?