Created
May 23, 2012 08:32
-
-
Save lambdaterm/2773916 to your computer and use it in GitHub Desktop.
test boot from NFS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import datetime | |
import struct, socket, fcntl | |
def getHwAddr(ifname): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15])) | |
return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1] | |
mac = str(getHwAddr('eth0')) | |
if os.path.exists("python.log." + mac): | |
file = open("python.log." + mac, "a") | |
date = str(datetime.datetime.now()) | |
file.write(date + "\n") | |
else: | |
file = open("python.log." + mac, "w") | |
date = str(datetime.datetime.now()) | |
file.write(date + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment