Annotation of loncom/lonManage, revision 1.3

1.1       foxr        1: #!/usr/bin/perl
                      2: # The LearningOnline Network with CAPA
                      3: #
                      4: #  lonManage supports remote management of nodes in a LonCAPA cluster.
                      5: #
1.3     ! foxr        6: #  $Id: lonManage,v 1.2 2003/08/12 09:58:49 foxr Exp $
1.1       foxr        7: #
1.3     ! foxr        8: # $Id: lonManage,v 1.2 2003/08/12 09:58:49 foxr Exp $
1.1       foxr        9: #
                     10: # Copyright Michigan State University Board of Trustees
                     11: #
                     12: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                     13: ## LON-CAPA is free software; you can redistribute it and/or modify
                     14: # it under the terms of the GNU General Public License as published by
                     15: # the Free Software Foundation; either version 2 of the License, or
                     16: # (at your option) any later version.
                     17: #
                     18: # LON-CAPA is distributed in the hope that it will be useful,
                     19: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     20: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     21: # GNU General Public License for more details.
                     22: #
                     23: # You should have received a copy of the GNU General Public License
                     24: # along with LON-CAPA; if not, write to the Free Software
                     25: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     26: #
                     27: # /home/httpd/html/adm/gpl.txt
                     28: #
                     29: # http://www.lon-capa.org/
                     30: #
                     31: #
                     32: #   lonManage supports management of remot nodes in a lonCAPA cluster.
                     33: #   it is a command line tool.  The following command line syntax (usage)
                     34: #   is supported:
                     35: #
                     36: #    lonManage  -push   <tablename>  newfile  host
                     37: #        Push <tablename> to the lonTabs directory.  Note that
                     38: #        <tablename> must be one of:
                     39: #           hosts  (hosts.tab)
                     40: #           domain (domain.tab)
                     41: #
                     42: #    lonManage  -reinit lonc host
                     43: #           Sends a HUP signal to the remote systems's lond.
                     44: #
                     45: #    lonmanage  -reinit lond host
                     46: #          Requests the remote system's lond perform the same action as if
                     47: #          it had received a HUP signal.
                     48: #
                     49: #    In the above syntax, the host above is the hosts.tab name of a host,
                     50: #    not the IP address of the host.
                     51: #
1.3     ! foxr       52: #  $Log: lonManage,v $
        !            53: #  Revision 1.2  2003/08/12 09:58:49  foxr
        !            54: #  Add usage and skeleton documentation.
1.2       foxr       55: #
1.3     ! foxr       56: #
        !            57: use Getopt::Long;
1.2       foxr       58: 
1.3     ! foxr       59: sub Usage  {
1.2       foxr       60:     print "Usage:";
                     61:     print <<USAGE;
1.3     ! foxr       62:     lonManage  --push=<tablename>  newfile  host
1.2       foxr       63:         Push <tablename> to the lonTabs directory.  Note that
                     64:         <tablename> must be one of:
                     65:            hosts  (hosts.tab)
                     66:            domain (domain.tab)
                     67: 
1.3     ! foxr       68:     lonManage  --reinit=lonc host
1.2       foxr       69:            Sends a HUP signal to the remote systems's lond.
                     70: 
1.3     ! foxr       71:     lonmanage  --reinit=lond host
1.2       foxr       72:           Requests the remote system's lond perform the same action as if
                     73:           it had received a HUP signal.
                     74: 
                     75:     In the above syntax, the host above is the hosts.tab name of a host,
                     76:     not the IP address of the host.
                     77: USAGE
                     78: 
                     79: 
                     80: }
                     81: 
                     82: #
1.3     ! foxr       83: #  Use Getopt::Long to parse the parameters of the program.
        !            84: #
        !            85: #  Return value is a list consisting of:
        !            86: #    A 'command' which is one of:
        !            87: #       push   - table push requested.
        !            88: #       reinit - reinit requested.
        !            89: #   Additional parameters as follows:
        !            90: #       for push: Tablename, hostname
        !            91: #       for reinit: Appname  hostname
        !            92: #
        !            93: #   This function does not validation of the parameters of push and
        !            94: #   reinit.
        !            95: #   returns an empty list if the parse fails.
        !            96: #
        !            97: 
        !            98: sub ParseArgs {
        !            99:     return ();
        !           100: }
        !           101: 
        !           102: #
1.2       foxr      103: #    If command parsing failed, then print usage:
                    104: 
1.3     ! foxr      105: @status = ParseArgs;=
        !           106: $nparam   = @status;
        !           107: 
        !           108: if($nparam == 0) {
1.2       foxr      109:     Usage;
                    110: }
                    111: 
                    112: =head1 NAME
                    113:     lonManage - Command line utility for remote management of lonCAPA
                    114:     cluster nodes.
                    115: 
                    116: =head1 SYNOPSIS
                    117: 
                    118: Usage:
1.3     ! foxr      119:     B<lonManage  --push=<tablename>  newfile  host>
1.2       foxr      120:         Push <tablename> to the lonTabs directory.  Note that
                    121:         <tablename> must be one of:
                    122:            hosts  (hosts.tab)
                    123:            domain (domain.tab)
                    124: 
1.3     ! foxr      125:     B<lonManage  --reinit=lonc host>
1.2       foxr      126:            Sends a HUP signal to the remote systems's lond.
                    127: 
1.3     ! foxr      128:     B<lonmanage  --reinit=lond host>
1.2       foxr      129:           Requests the remote system's lond perform the same action as if
                    130:           it had received a HUP signal.
                    131: 
                    132:     In the above syntax, the host above is the hosts.tab name of a host,
                    133:     not the IP address of the host.
                    134: 
                    135: 
                    136: =head1 DESCRIPTION
                    137: 
                    138: =head1 PREREQUISITES
1.3     ! foxr      139: 
        !           140: =item Getopt::Long
1.2       foxr      141: 
                    142: =head1  CATEGORIES
                    143:     Command line utility
                    144: 
                    145: =cut

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>