Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #Open the file
- log = open('assaultcube.log')
- #Set logs dict
- logs = { 'asylum' : '', 'warrior' : '', 'coop' : '', 'clash' : '', 'castle' : '' }
- #Loop through each line
- for line in log.readlines():
- #Check for nl and length
- if line == '\n' or len(line.split('[')[1].split(']')[0]) > 7:
- continue
- #Add to logs
- logs[line.split('[')[1].split(']')[0]] += line
- #Seperate out the files
- [open('/var/www/aclogs/' + server + '/' + server + '_' + logs[server][0:7].strip().replace(' ', '_') + '.log', 'w').write(logs[server]) for server in logs]
- #Fix the assaultcube log file
- open('assaultcube.log', 'w').write('')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement