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


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.

  1. # A simple shell script wrapper start / stop / restart nfsv4 services on CentOS / RHEL
  2. # Tested on: RHEL / CentOS but can be ported to Debian or other distros.
  3. # ----------------------------------------------------------------------------
  4. # Author: nixCraft <http://www.cyberciti.biz>
  5. # Copyright: 2009 nixCraft under GNU GPL v2.0+
  6. # ----------------------------------------------------------------------------
  7. # Last updated: 20/Mar/2013 - Added support for RHEL 6.x
  8. # ----------------------------------------------------------------------------
  9. ## RHEL/CentOS init.d script names
  10. _server="/etc/init.d/rpcbind /etc/init.d/rpcidmapd /etc/init.d/nfslock /etc/init.d/nfs"
  11. _client="/etc/init.d/rpcbind /etc/init.d/rpcidmapd /etc/init.d/nfslock"
  12. ## Run either server or client script with the following action:
  13. # stop|start|restart|status
  14. echo "$ _me start|stop|restart|reload|status";
  15. nfs.server) runme "$ _server" "$ _action" ;;
  16. nfs.client) runme "$ _client" "$ _action" ;;
  17. Download and install the script as follows: 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.

Artikel terbaru :