Start and stop services using service and chkconfig

You can use the service and chkconfig commands on the command line to start, stop, and modify the run levels of the /etc/init.d scripts. Changes to the run levels require root access.

Start and stop the API Gateway service

You can use the service command to start and stop the API Gateway service:

# service vshell-GROUP_NAME-INSTANCE_NAME start

You must specify the API Gateway instance name and the group name. For example, to start the API Gateway instance called APIGateway1 in group Group1 as a service, enter the following command:

# service vshell-Group1-APIGateway1 start

To stop the API Gateway service:

# service vshell-GROUP_NAME-INSTANCE_NAME stop

To restart the service:

# service vshell-GROUP_NAME-INSTANCE_NAME restart

To get a status of the service:

# service vshell-GROUP_NAME-INSTANCE_NAME status

Get the status of services

The service command can also be used to get the status of other system services such as the firewall (iptables). The following command shows the status of the firewall and lists the active rules if the service is enabled:

# service iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
num  target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

Table: mangle
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
num  target     prot opt source               destination         

Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 255 
3    ACCEPT     esp  --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     ah   --  0.0.0.0/0            0.0.0.0/0           
5    ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         udp dpt:5353 
6    ACCEPT     112  --  0.0.0.0/0            224.0.0.18          
7    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
8    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
9    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80 
10   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:443 
11   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:8080 
12   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:8090 
13   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:10000 
14   ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:123 
15   ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           state NEW udp dpt:161 
16   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:389 
17   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:636 
18   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:1521 
19   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:3306 
20   REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination     

Enable or disable services on system start

You can use the chkconfig --list command to get a list of services and their enabled or disabled state on a given run level. The appliance operates at run level 3.

To find which services are enabled at this run level, execute:

# chkconfig --list | grep “3:on”

Conversely, to find which services are disabled at this run level, execute:

# chkconfig --list | grep “3:off”

To enable a given service (for example, postfix) at a run level, execute the following:

# chkconfig --level 3 postfix on

Related Links