ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

IFS Housekeeping

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • IFS Housekeeping

    Hi,

    Has anyone got any tips on housekeeping the IFS? Ours hasn't been touched for years and is starting to get rather large!

    Just wondering on a good place to start!

    Thanks,

    Adam

  • #2
    Re: IFS Housekeeping

    you can run api's or QSHELL commands to delete files not used in XXX days
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: IFS Housekeeping

      We recently put in a monthly batch job which would do the following to all IFS files which were last accessed over 1 year (using QSHELL commands):-

      1.) Add to a zip file on the IFS
      2.) Delete the file

      Every month, the job runs, the previous month's zip file is deleted. Should someone need it, we can always restore from our tapes (usually they wouldnt need since majority of the files on IFS are reports which can be generated again by calling the respective programs).

      Comment


      • #4
        Re: IFS Housekeeping

        Hi vikramx

        Thanks for the advice. That is exactly what I would like to do - set up a monthly batch job to delete old IFS files.

        I haven't used QSHELL commands before, please could you help me out in what I would need to put in the code?

        Comment


        • #5
          Re: IFS Housekeeping

          What we did was a very very simple approach.

          1.) Using STRQSH command, we executed the command "FIND <root directory> -type F". Doing would output the file listing to the file overriden to STDOUT. Full paths will be stored by this method.

          eg. STRQSH CMD('find /testdir -type f')

          2.) Read the flat file and use the Qp0lGetAttr API to get the attributes of the files. Other possible methods we looked at was, DSPLNK and redirect the output to a spool, copy the spool to a PF and then get the attributes (problem was on the no: of spool files generated).

          3.) Once the attributes are retrieved, you can apply whatever rules you decided upon to clean em up.

          Comment


          • #6
            Re: IFS Housekeeping

            Save this in a file and just type the name of this file in qsh to run it. Of course you need to change the directory and variables. This backs up files not accessed in the last 13 days into a tar file named as the current date
            Code:
            #GET FILES NOT ACCESSED DAYS
            DAYS="13"
            
            #Specify the Top Level Directory path you want to 
            DIR="/home/me"
            
            
            #GET DATE
            dt=`date +%Y-%m-%d`
            #CREATE TAR
            tar -cvf /home/backups/${dt}.tar /dev/null
            
            #Specify the output filename
            FILENAME="Files_For_Archiving"
            find "${DIR}" -type f -atime +${DAYS} > /home/backups/filelist 
            while read LINE
            do
            echo $LINE
            tar -rf /home/backups/${dt}.tar  ${LINE}
            #DELETE FILE
            # rm  ${LINE}
            
            done  < /home/backups/filelist

            Comment

            Working...
            X