While running the following code I am facing Issue 'sysctl' command not found

execute 'RELOADING KERNEL PARAMENTERS' do
command 'sysctl -e -p'
action :run
end

but this is working
execute 'RELOADING KERNEL PARAMENTERS' do
command '/usr/sbin/sysctl -e -p'
action :run
end

Can some one check why it is so?

This is not really a Chef thing but rather an OS-version specific thing. Not all OS versions include /sbin or /usr/sbin in the default PATH for root (or whatever user you are running w/chef). I know that CentOS/RHEL 5 and really old versions of 6 never included /usr/sbin in the PATH by default for example. That always trips me up when I go back and use older versions of the os.

You'll see a similar issue with running things in a system context under cron as well.

That's why it's best to specify the full PATH to the binary, as you did in your second example. Or you could set the PATH in the environment resource. By default the Chef execute resource doesn't set the PATH to anything - it's just whatever the system default is.

Small correction - you can set the PATH in the environment ATTRIBUTE of the execute resource (not the environment resource)