Sysadmin

The sysadmin script has evolved … into a snake AHHHHHHHH!

The newest version of the Sysadmin helper package is written in python, improving executing time and removing the need in many cases for writing temporary files.

Requirements:

  • *nix Operating system (L.A.M.P Server is ideal, this also works on OS X 10.5)
  • root / sudoer account on server
  • Subversion client on server (for updates)
  • Python 2.4 or higher (Should work with Earlier verisions but I have not tested)
      Installation:

      1
      2
      mkdir ~/.sysadmin
      svn co http://svn.saiweb.co.uk/branches/linux-the-sysadmin-script/trunk/ ~/.sysadmin/

      Alias setup Linux:

      1
      2
      3
      4
      echo "alias sysadmin='~/.sysadmin/sysadmin.py'" >> ~/.bashrc
      echo "alias sysadmin-update='svn update ~/.sysadmin'" >> ~/.bashrc
      alias sysadmin='~/.sysadmin/sysadmin.py'
      alias sysadmin-update='svn update ~/.sysadmin'

      NOTE: Always backup you config before updating. (~/.sysadmin/conf).

      Now you’re ready to go :-)

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      Your python version is < 2.5 (2.4.3)
      hashlib has not been loaded, md5 has been loaded
      usage:
         
          ### Sysadmin Script by D.Busby                                          ###
          ### http://saiweb.co.uk                                                 ###
          ### license: http://creativecommons.org/licenses/by-sa/2.0/uk/ CC BY-SA ###
         
          sysadmin.py -c command -d csv,seperated,data
         
          Available commands:
         
              iconv - This command is used to convert a files contents character encoding
              Example: -c iconv -d /path/to/file.ext,latin-1,utf-8
             
              appmem - This command is used to estimate the memory usage of a currently running process
              Example: -c appmem -d filter
              Note: filter can be the process name i.e. httpd or anything else you wish to filter by i.e. PID
             
              checksum - This command will read a file and provide crc32 and md5 checksums, this does however require Python 2.5 or higher to run
              Example: -c checksum -d /path/to/file
              Notes: A Python version of 2.5 or higher is required, also if a file larger than 30MB is selected the user will be required to confirm before proceeding
             
              rblcheck - This command will attempt to check if the provided IP address is listed at several RBLs
              Example: -c rblcheck -d 123
             
              httpd_stats (BETA) - This command will attempt to provide rough statistics based on the provided apache log file.
              Example: -c httpd_status -d /path/to/access.log
              Notes: This function assumes combined output, this may not work with other log types
             
              windowsreturn (BETA) - This command will remove all \r (^M) chars from a file, windows typically uses \r\n for carriage returns, this causes issues particularly when used in bash scripts
              Example: -c windowsreturn -d /path/to/file
              Notes: This will overwrite the original file, as such make sure you have a backup
             
              fscompare - This command will attempt to compare files between two directories, checking if they exist and their file hashes
              Example: -c fscompare -d /path/to/folder1,/path/toi/folder2
             
              manifest (BETA) - This command will attempt to iterate the given path and generate an md5 manifest file for all files in that path and it's subdirectories, or verify an existing manifest
              Example: -c manifest -d /path/to/folder
              Example: -c manifest -d /path/to/existing.manifest
              Notes: If bulding a new manifest this will write out a dd-Mon-YYYY.manifest file in your CWD (current working directory) so make sure you are not in the path you are indexing!
3 Responses to “Sysadmin”
  1. [...] Sysadmin [...]

  2. [...] already familiar with it, however if your system has python installed you can grab a copy of my sysadmin program which has iconv like functionality but is far more user friendly. What you will [...]

  3. [...] Sysadmin [...]

Leave a Reply

Creative Commons License