SADMIN Python library - function ‘trimfile’
Function used to trim a file to the desired number of lines.
Trim the file received to the number of lines indicated in the second parameter. - If 2nd parameter 'nlines' is omitted a value of 500 is use. - If 2nd parameter 'nlines' is specified and is 0, then no trim is done on the file. Arguments: filename (str) : Full path of the file to trim. nlines (int) : Keep the last "nlines" lines of the file. No trim is done if nlines equal 0. Returns: returncode (int): 0 When command executed with success 1 When error occurred (Permission Error)
if ((log_footer) and (max_logline != 0)) : trimfile (log_file,max_logline) # Trim the Script Log
|Link to …||Description|
|sadm_requirements.sh||List/install required SADMIN tools packages|