Changeset 2600


Ignore:
Timestamp:
Oct 13, 2016, 2:58:04 PM (3 years ago)
Author:
kbut
Message:

test log functions

Location:
lliurex-mirror/trunk/fuentes/n4d-lliurex-mirror.install
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lliurex-mirror/trunk/fuentes/n4d-lliurex-mirror.install/etc/n4d/conf.d/MirrorManager

    r2516 r2600  
    3333get_mirror=adm,admins
    3434stopgetmirror=adm,admins
     35get_last_log=anonymous,*
  • lliurex-mirror/trunk/fuentes/n4d-lliurex-mirror.install/usr/bin/lliurex-mirror-get-last-log

    r2599 r2600  
    11#!/bin/bash
    22destiny=$(mktemp)
    3 x=$(cat /var/log/lliurex-mirror.log | grep "START MIRROR AT"|tail -1)
     3x=$(cat /var/log/lliurex-mirror.log | grep "MIRROR START AT "|tail -1)
    44sed -n "/$x/,\$p" /var/log/lliurex-mirror.log > $destiny
    55echo $destiny
  • lliurex-mirror/trunk/fuentes/n4d-lliurex-mirror.install/usr/share/n4d/python-plugins/MirrorManager.py

    r2594 r2600  
    164164                fd = open('/var/log/lliurex-mirror.log','a')
    165165                import datetime
    166                 fd.write("************************* " + str(datetime.datetime.now())+ " ***********************************\n")
     166                fd.write("MIRROR START AT " + str(datetime.datetime.now())+ " \n")
    167167                fd.flush()
    168168                errors_found = False   
     
    668668                        c.stop_webserver('','MirrorManager',callback_args['port'])
    669669        #def _get
     670
     671        def get_last_log(self):
     672                import subproces
     673                p = subproces.Popen('lliurex-mirror-get-last-log',stdout=subproces.PIPE)
     674                path = p.communicate()[0]
     675                f = open(path,'r')
     676                content = f.readlines()
     677                onelinecontent = '\n'.join(content)
     678                return {'status':True,'msg':onelinecontent}
     679
     680
     681
Note: See TracChangeset for help on using the changeset viewer.