#!/usr/bin/env python # Depends on package: bsdutils import random, string, subprocess, os from datetime import time, date, datetime from time import strftime rand = ''.join(random.choice(string.letters + string.digits) for i in xrange(8)) rand = "%s_%s" % (strftime("%Y%m%d_%H%M%S"), rand) subprocess.call("script -qt -c 'su -s \"/bin/bash\" cvm' -a /etc/cvm/log/log.%s 2>/etc/cvm/log/log.%s.time" % (rand, rand), shell=True) if os.environ['SHELL'] != "/bin/bash": os.remove("/etc/cvm/log/log.%s.time" % rand) os.remove("/etc/cvm/log/log.%s" % rand)