As such a single command I never heard but yes you can do the task through scripting
Chris already suggested with xinetd and so just read and explore
Other than if you are interested to go with scripting you can follow the given below details
To start and stop the service, the command is "service service-name start" and "service service-name stop"
And to disable and enable the service at runlevel (bydefault runlevel 3 and 5) , we have command "chkconfig service-name on" or "chkconfig service-name off" .
I
assume your requirement is to start/stop and disable/enable multiple service through command line.
If it is like that create a script or even you can directly write on terminal without creating any shell script file
eg. I have a few service like httpd,mysqld and iptables. Now I want to disable/enable or stop/start the service
For stopping
Quote:
for i in httpd mysqld iptables ;do service $i stop;chkconfig $i off;done
|
OR
Create a file called service-list and write down all service name in this manner
httpd
mysqld
iptables
then script will be like this
Quote:
for i in `cat service-list`;do service $i stop;chkconfig $i off;done
|
And For start again
Quote:
for i in httpd mysqld iptables ;do service $i start;chkconfig $i on;done
|
OR
Quote:
for i in `cat service-list`;do service $i start;chkconfig $i on;done
|