How do I create a command to run with sudo?

I have created a file called svrestart in /home/gab/bin (which is a folder that should be automatically be added to path on startup) which contains:

/etc/init.d/nginx restart
/etc/init.d/php5-fpm restart


Then I did chmod +x svrestart and then I rebooted.

Now if I run svrestart I get a permission denied error because I can't have access to these services. If I run sudo svrestart, on the other hand, I get:

sudo: svrestart: command not found


Because the command is hosted in /home/gab/bin and the root user probably can't find it.

How do I make this work?

-

sudo /etc/init.d/nginx restart

You will be prompted for the sudo password for the first command.
... unless he's a sudoer without password. –  Daniel Beck Dec 30 '11 at 10:11
@DanielBeck Isn't there a difference between GNU sudo and the one on OS X here? What's to do in this case, actually? –  slhck Dec 30 '11 at 10:21
Run less /etc/sudoers and look for %wheel, the traditional Unix (?) admin group. There is one line requiring a password, another not requiring it. %admin, the OS X group used instead, also requires a password. Edit the file (as root of course), add NOPASSWD in the %admin line, sudo -k to invalidate your sudo timestamp (so you'd need to enter your password again even though you entered it only a short time ago), and sudo ls. No password required. –  Daniel Beck Dec 30 '11 at 10:25