Script to Shutdown AIX - Aix

This is a discussion on Script to Shutdown AIX - Aix ; I have inherited an IBM AIX RS/6000 with AIX v5.3. It is connected to a network with a Windows Server and both are powered by an APC UPS. I connected the UPS to the Windows Server via the serial cable ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Script to Shutdown AIX

  1. Script to Shutdown AIX

    I have inherited an IBM AIX RS/6000 with AIX v5.3. It is connected to
    a network with a Windows Server and both are powered by an APC UPS. I
    connected the UPS to the Windows Server via the serial cable have
    installed the free PowerChute Business Edition on the Windows Server
    (easier to remotely administer PowerChute via the server than the AIX
    machine).

    If there is a power cut, I intend to have PowerChute run a batch file
    on the Windows Server that FTP's a file to the AIX machine. When this
    file is detected on the AIX machine, I want it to initiate a shutdown.

    The bit I am stuck on is how to set up the program/task on the AIX
    machine to detect the FTP'ed file from the Windows Server and what
    commands to write to tell the AIX to shutdown.

    Is this the best way to go about this?

    I have read lots of other posts and found rc.powerfail and shutdown
    files in etc/ directory but am slightly unsure how to call them...is
    it better to use these files instead of my own?


  2. Re: Script to Shutdown AIX

    I'd have someone write this for me!
    Seriously you would need to create a cronjob that executes the script
    like once a (how long can the UPS power both servers?)
    minute? you would use the crontab command to edit the crontab --- read
    the man page on crontab.
    The kornshell script could do a ls -l /directory/filename then
    evaluate the return code -- if it returns a 0 that might mean that no
    file was found
    (I do not know how to evaluate return code) after it discovers the
    file it executes /usr/sbin/shutdown
    This would be a 4-7 line script.
    though reading through documentation its appears that the rc.powerfail
    notices a lose of AC power and shuts down the system
    here is the documentation that I was reading
    http://publib.boulder.ibm.com/infoce....powerfail.htm

    If this is an AIX 5.3 system then you should be able to call AIX
    Supportline to confirm


  3. Re: Script to Shutdown AIX

    This command will check for a file

    if [[ -a /directory/filename ]]

    so you would include it in a script

    if [[ -a /directory/filename ]]
    then
    shutdown -F
    done
    else
    whatever you may want to do if there is no file
    fi

    You may want to get a scripting book if you are going to be resonsible
    for this server.
    Kornshell Programming Tutorial by Barry Rosenberg is a good one for
    beginners.
    It teaches pretty much by example.




  4. Re: Script to Shutdown AIX

    Thanks alot guys...I do know someone who can help with the coding, I
    am just trying to get all the research done for them so they know what
    to write!


  5. Re: Script to Shutdown AIX

    On Sep 19, 6:19 am, rminni...@hotmail.com wrote:
    > Thanks alot guys...I do know someone who can help with the coding, I
    > am just trying to get all the research done for them so they know what
    > to write!


    FTP is evil. Involves leaving passwords for the root user lying around
    and ports sniffers see clear text passwords; root user in this case.
    You need to use SSH keys, and a locked down user that uses sudo and
    the shutdown command. sudo is your friend for allowing specific root
    permissions for users and commands. It's free to download the AIX
    version from IBM.
    http://www-03.ibm.com/systems/p/os/a.../download.html

    so, first thing, make sure you have SSH installed on both your Windows
    and AIX environments, and sudo installed on AIX.
    you then need to create a SSH Type-2 (DSA) key
    there is plenty of information on the Net about sudo, SSH keys and how
    to create a secure way for remote executions using a SSH key that only
    allows the shutdown from a specific IP address and a Shell wrapper for
    the sudo permissions
    Scripting should be unnecessary but good documentation means those who
    follow after you won't come hunting for your with sharp objects.

    This won't be quick and dirty to do right.


  6. Re: Script to Shutdown AIX

    On Tue, 18 Sep 2007 07:59:52 -0700, rminnis82 wrote:

    > I have inherited an IBM AIX RS/6000 with AIX v5.3. It is connected to a
    > network with a Windows Server and both are powered by an APC UPS. I
    > connected the UPS to the Windows Server via the serial cable have
    > installed the free PowerChute Business Edition on the Windows Server
    > (easier to remotely administer PowerChute via the server than the AIX
    > machine).
    >
    > If there is a power cut, I intend to have PowerChute run a batch file on
    > the Windows Server that FTP's a file to the AIX machine. When this file is
    > detected on the AIX machine, I want it to initiate a shutdown.
    >
    > The bit I am stuck on is how to set up the program/task on the AIX machine
    > to detect the FTP'ed file from the Windows Server and what commands to
    > write to tell the AIX to shutdown.
    >
    > Is this the best way to go about this?
    >
    > I have read lots of other posts and found rc.powerfail and shutdown files
    > in etc/ directory but am slightly unsure how to call them...is it better
    > to use these files instead of my own?



    It may be a silly question, but why not buy a copy of PowerChute for AIX?
    Or, does the version on Windows not broadcast a shutdown message on the
    network?

    http://www.apcc.com/support/compliance_table.cfm

    They seem to make it for a whole lot of different operating systems... :-)

    -Chris

  7. Re: Script to Shutdown AIX

    rminnis82@hotmail.com wrote:
    > [snip]
    > The bit I am stuck on is how to set up the program/task on the AIX
    > machine to detect the FTP'ed file from the Windows Server and what
    > commands to write to tell the AIX to shutdown.
    >
    > Is this the best way to go about this?
    >
    > I have read lots of other posts and found rc.powerfail and shutdown
    > files in etc/ directory but am slightly unsure how to call them...is
    > it better to use these files instead of my own?


    Can the WIndows machine kick something off on the AIX machine via RSHELL?

    --
    David J Dachtera
    dba DJE Systems
    http://www.djesys.com/

    Unofficial OpenVMS Marketing Home Page
    http://www.djesys.com/vms/market/

    Unofficial Affordable OpenVMS Home Page:
    http://www.djesys.com/vms/soho/

    Unofficial OpenVMS-IA32 Home Page:
    http://www.djesys.com/vms/ia32/

    Unofficial OpenVMS Hobbyist Support Page:
    http://www.djesys.com/vms/support/

  8. Re: Script to Shutdown AIX


    > Can the WIndows machine kick something off on the AIX machine via RSHELL?


    Yes, you can but many will tell you (including me) that r commands
    aren't secure and can be circumvented easily.
    Especially in that type of setup.

    You'll have to be careful of the ip address the windows box has and
    what is being resolved in DNS / local host table on the AIX side to
    make this work consistently with a .rhosts file.

    We setup cygwin with ssh key authentication access on the windows box
    so we can run commands the other way around (aix to windows).
    Of course that could be setup to do windows to aix as well.






  9. Re: Script to Shutdown AIX

    Scottz wrote:
    >
    > > Can the WIndows machine kick something off on the AIX machine via RSHELL?

    >
    > Yes, you can but many will tell you (including me) that r commands
    > aren't secure and can be circumvented easily.
    > Especially in that type of setup.
    >
    > You'll have to be careful of the ip address the windows box has and
    > what is being resolved in DNS / local host table on the AIX side to
    > make this work consistently with a .rhosts file.


    I've been doing that (VMS <-> Solaris, actually) in my production backups for
    four-plus years. (BAckup target is StorageTek's L700e library controlled by
    ACSLS.) Everything is static addressed; so, once DNS is set, it stays set (until
    the usual dinking around messes things up, but that's rare in our shop - these
    guys are fairly decent).

    I also tried Windows RSHELL and RCP to/from both VMS and Solaris. Got that to
    work o.k., but the application functionality (NetWorker Server and CLARiiON Disk
    Library (FalconStor)) came up short in the end - couldn't do what we needed.

    The auditors, security folks, etc. haven't demanded encryption inside the
    firewall yet (but it's probably on someone's roadmap). So, haven't played much
    with S-services, SSL, etc.

    > We setup cygwin with ssh key authentication access on the windows box
    > so we can run commands the other way around (aix to windows).
    > Of course that could be setup to do windows to aix as well.


    Yeah - WhineBloze has enough security issues without exposing the rest of the
    world to them by shipping UN*X servers/services with WhineBloze.

    --
    David J Dachtera
    dba DJE Systems
    http://www.djesys.com/

    Unofficial OpenVMS Marketing Home Page
    http://www.djesys.com/vms/market/

    Unofficial Affordable OpenVMS Home Page:
    http://www.djesys.com/vms/soho/

    Unofficial OpenVMS-IA32 Home Page:
    http://www.djesys.com/vms/ia32/

    Unofficial OpenVMS Hobbyist Support Page:
    http://www.djesys.com/vms/support/

+ Reply to Thread