Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Are there any standards for aliasing sudo /etc/init.d/? I'm sure many people have considered cutting down these 17 characters to just 2 or so.

share|improve this question
    
Interesting idea. –  Tim Jun 5 '12 at 20:40

3 Answers 3

up vote 6 down vote accepted

On Linux with SysVinit (the traditional init implementation), the service command is a shell script that calls a script in /etc/init.d.

sudo service wibble restart

service also knows to look for Upstart jobs if available. Upstart also comes with start, stop, reload and restart commands.

sudo restart wibble

I recommend keeping sudo to remind you that this is something performed as root.

share|improve this answer

Something to consider, most systems have the "service" command, that could replace the /etc/init.d/ portion of your sudo command.

You could do for example:

alias sserv="sudo service"

example: (pay no attention to the root behind the curtain)

[root@talara javaWs.git]# sserv pdns restart
Restarting PowerDNS authoritative nameserver: stopping and waiting..done
Starting PowerDNS authoritative nameserver: started
share|improve this answer
    
Good to know. Never used that alias before. –  Tim Jun 5 '12 at 20:56

Have a look at the this snippet in Grmls zshrc. It defines 5 function Start Stop Restart Reload Force-Reload to start/stop a daemon.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.