[DSHub]Basic Info 0.1b

Python Script Releases, known supporting hubsofts for python scripting.

DSHub | ADCH++
Locked
Toast

[DSHub]Basic Info 0.1b

Post by Toast » 16 Nov 2008, 11:27

Code: Select all

#   Basic  Information 0.1b
#   By Toast 08-11-15
#
#   Licensed under LGPL
#   http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
#
#   Prints out Hostname and PID for process
#   Simple script (example for DSHub)
#  
#   Changes 0.1a
#   Added support for log (basic_info.log)
#   Added working directory,  Java/Platform Version and user id to this version
#   Added Garbage Collector
#
#   Changes 0.1b
#   Cleaned up script 
#   Added License info
import sys, socket, os, sys, platform, gc, time
gc.enable()
hostname = socket.gethostname()
pathname = os.path.dirname(sys.argv[0])
print "Basic Info:","\n","Hostname:", hostname,"\n","Platform:", platform.platform(aliased=1, terse=0),"\n",'Working Directory:', sys.argv[0] ,os.path.abspath(pathname),"\n",'Parent Process ID:', os.getpid(),"\n",'Real User ID:', os.getuid(),"\n\n","Saving to information to basic_info.log"
f = open('basic_info.log', 'w')
print >> f, "Basic Info:","\n\n","Hostname:", hostname,"\n","Platform:", platform.platform(aliased=1, terse=0),"\n",'Working Directory:', sys.argv[0] ,os.path.abspath(pathname),"\n",'Parent Process ID:', os.getpid(),"\n",'Real User ID:', os.getuid()
print >> f, ""
gmt = time.gmtime(time.time())
fmt = '%a, %d %b %Y %H:%M:%S GMT'
str = time.strftime(fmt, gmt)
hdr = str
print >> f, "Log Generated at:", hdr
print All info saved to basic_info.log ..
f.close()
Description: A simple script that generates a log of the process for DSHub, hostname and platform. It also prints to console upon start up of DSHub this might be useful for Linux users.
Attachments
basic_info.py
(1.35 KiB) Downloaded 402 times

Locked