You use the chkconfig command to administer one of the services on your Oracle Linux system:
[root@FAROUT ~]# chkconfig vncserver off
[root@FAROUT ~] #
No changes have been made to the init script for the service.
Which two statements are true regarding the effects of Issuing this command?
A.
The vncserver service is shut down.
B.
The vncserver service configuration is disabled only for those run levels for which it is currently
enabled.
C.
The vncserver service configuration is disabled for run levels 2, 3, 4 and 5.
D.
The vncserver service remains in the same state it was in before the command was issued.
E.
The vncserver service configuration is disabled for run levels 3 and 5 only.
Explanation:
Reference: http://www.oracle-base.com/articles/linux/configuring-vnc-server-on-linux.php
B, D
C, D
Answer is C, D
C,D
Option A Explain:
If one of on, off, or reset is specified after the service name, chk-
config changes the startup information for the specified service. The
on and off flags cause the service to be started or stopped, respec-
tively, in the runlevels being changed. The reset flag resets the
startup information for the service to whatever is specified in the
init script in question.
[root@olite-emea rc3.d]# chkconfig –list | grep vnc
vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@olite-emea rc3.d]# chkconfig vncserver off
[root@olite-emea rc3.d]# chkconfig –list | grep vnc
vncserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@olite-emea rc3.d]# chkconfig vncserver on
[root@olite-emea rc3.d]# chkconfig –list | grep vnc
vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[Jef@ToshibaZ30-Jef etc]$ sudo chkconfig rhnsd off
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
—> A, B (=obvious), C True also
—> not E, not D
[Jef@ToshibaZ30-Jef etc]$ sudo chkconfig rhnsd on
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[Jef@ToshibaZ30-Jef etc]$ sudo chkconfig –level 5 rhnsd off
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:on 3:on 4:on 5:off 6:off
[Jef@ToshibaZ30-Jef etc]$ sudo chkconfig rhnsd off
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[Jef@ToshibaZ30-Jef etc]$ sudo chkconfig rhnsd on
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
—> rhnsd service back on for 2,3,4 obvious and 5 which was off before
[Jef@ToshibaZ30-Jef etc]$ sudo chkconfig –level 5 rhnsd off
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:on 3:on 4:on 5:off 6:off
[Jef@ToshibaZ30-Jef etc]$ sudo chkconfig rhnsd reset —> back to default value
[Jef@ToshibaZ30-Jef etc]$ chkconfig | grep rhnsd
rhnsd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
from man chkconfig :
If one of on, off, reset, or resetpriorities is specified after the service name, chkcon‐
fig changes the startup information for the specified service. The on and off flags
cause the service to be started or stopped, respectively, in the runlevels being changed.
The reset flag resets the on/off state for all runlevels for the service to whatever is
specified in the init script in question, while the resetpriorities flag resets the
start/stop priorities for the service to whatever is specified in the init script.
By default, the on and off options affect only runlevels 2, 3, 4, and 5, while reset and
resetpriorities affects all of the runlevels. The –level option may be used to specify
which runlevels are affected.
So most correct answer should be A,C
The service will be stopped the next time you enter one of these runlevels. If you need to stop the service immediately, use the service command as described in Section 11.3.3, “Stopping a Service”.
So correct Answers are C,D NOT A
We are not shutting down the service that is why is in same stated, D is correct
We do not know what is the current configuration that is why we can not decide which run levels is disabled after issuing the command. We can only guess that it has been disable on run levels which currently enabled, B is correct also.
C, D, – be sure guys
CD
Use man to check chkconfig off, it has a clear explanation.
C & D is correct ans .
Below is the real time explanation .
ans c . The vncserver service configuration is disabled for run levels 2, 3, 4 and 5.
Real time o/p
[root@soa11g rc3.d]# chkconfig –list vncserver
vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@soa11g rc3.d]# chkconfig off vncserver
[root@soa11g rc3.d]# chkconfig vncserver off
[root@soa11g rc3.d]# chkconfig –list vncserver
vncserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@soa11g rc3.d]# /etc/init.d/vncserver status
Xvnc (pid 6746) is running…
explanation
so here after firing chkconfig vncserver off run level 2,3,4,5 in pervious chkconfig vncserver list cmd you cam see 2,3,4,5 are in on remains other are in off state .
And after firing this chkconfig vncserver off still vncserver is running in the same PID .