RHEL / CentOS: Shell Script Wrapper TO Start / Stop / Restart NFSv4 Services In A Particular Order
A simple shell script wrapper to start / stop / restart NFSv4 service on CentOS / RHEL v.6.x server in a particular order. This script also demonstrates how to use the ln command to create soft links to the same script and take a different action as per $ 0.
# ---------------------------------------------------------------------------- # Author: nixCraft <http://www.cyberciti.biz> # Copyright: 2009 nixCraft under GNU GPL v2.0+ # ---------------------------------------------------------------------------- # Last updated: 20/Mar/2013 - Added support for RHEL 6.x # ---------------------------------------------------------------------------- ## RHEL/CentOS init.d script names _server="/etc/init.d/rpcbind /etc/init.d/rpcidmapd /etc/init.d/nfslock /etc/init.d/nfs" _client="/etc/init.d/rpcbind /etc/init.d/rpcidmapd /etc/init.d/nfslock" ## Run either server or client script with the following action: # stop|start|restart|status echo "$ _me start|stop|restart|reload|status"; nfs.server) runme "$ _server" "$ _action" ;;- Download and install the script as follows:
nfs.client) runme "$ _client" "$ _action" ;;wget http://bash.cyberciti.biz/dl/605.sh.zip unzip 605.sh.zip mv 605.sh nfs.rc mkdir ~/bin/ mv nfs.rc ~/bin/ cd ~/bin/ chmod +x nfs.rc ln -s nfs.rc nfs.server ln -s nfs.rc nfs.client
To start / stop / restart nfsv4 server services in a single go:# ~/bin/nfs.server stop # ~/bin/nfs.server status # ~/bin/nfs.server start # ~/bin/nfs.server restart
To start / stop / restart nfsv4 clients in a single go, enter:# ~/bin/nfs.client stop # ~/bin/nfs.client start # ~/bin/nfs.client restart # ~/bin/nfs.client status
Sample outputs:
rpcbind (pid 2379) is running... rpc.idmapd (pid 7410) is running... rpc.statd (pid 2397) is running...RHEL / CentOS: Shell Script Wrapper TO Start / Stop / Restart NFSv4 Services In A Particular Order
RHEL / CentOS: Shell Script Wrapper TO Start / Stop / Restart NFSv4 Services In A Particular Order
Terima kasih telah membaca artikel tentang RHEL / CentOS: Shell Script Wrapper TO Start / Stop / Restart NFSv4 Services In A Particular Order di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.