| 1 |
ninoborges |
8 |
# This program will grow to the point that it lets you do anything to one app
|
| 2 |
|
|
# server and have it replicate to all app servers.
|
| 3 |
|
|
# so far it does:
|
| 4 |
|
|
# removes a file
|
| 5 |
|
|
# Eborges
|
| 6 |
|
|
# 10.31.01
|
| 7 |
|
|
|
| 8 |
|
|
from lgflcntr import getoffice
|
| 9 |
|
|
import sys, os, tkFileDialog, shutil
|
| 10 |
|
|
|
| 11 |
|
|
appservers = getoffice()
|
| 12 |
|
|
todo = input("What would you like me to do?\n 1 Remove stuff \n 2 Move stuff \n 3 Replicate stuff out\n")
|
| 13 |
|
|
|
| 14 |
|
|
def remove():
|
| 15 |
|
|
for x in appservers:
|
| 16 |
|
|
print "Removing:"
|
| 17 |
|
|
#os.system('echo \\\%s\\app\\PeopleView_Users.txt'%x)
|
| 18 |
|
|
os.system('del \\\%s\\app\\commence\\updates\\commence user list.TXT'%x)
|
| 19 |
|
|
#os.system('rmdir \\\%s\\app\\logfiles'%x)
|
| 20 |
|
|
#print "Removing dir from ",x
|
| 21 |
|
|
#os.system('rmdir \\\%s\\app\\Bin\\FirmDir /S'%x)
|
| 22 |
|
|
#os.system('rmdir \\\%s\\app\\PhoneDir /S'%x)
|
| 23 |
|
|
#os.system('rmdir \\\%s\\app\\log_files\\SMS_Problems\\ /S'%x)
|
| 24 |
|
|
#os.system('del \\\%s\\app\\update\\Installs\\DOCSOpen\*.*'%x)
|
| 25 |
|
|
|
| 26 |
|
|
def move():
|
| 27 |
|
|
for x in appservers:
|
| 28 |
|
|
print "Moving:"
|
| 29 |
|
|
print x
|
| 30 |
|
|
os.system('move \\\%s\\app\\tmp\\wuurl2.log \\\%s\\app\\log_files'%(x,x))
|
| 31 |
|
|
|
| 32 |
|
|
def ReplicateOut():
|
| 33 |
|
|
replicateWhat = tkFileDialog.askopenfilename(initialdir = "U:\\nino\\Active SMS Installer Files", title = "Please select the file you would like to replicate")
|
| 34 |
|
|
fullDir = raw_input("Would you also like to have ALL of the contents of this ditectory replicated? (Y/N): ")
|
| 35 |
|
|
replicateDest = tkFileDialog.asksaveasfilename(initialfile = os.path.basename(replicateWhat),initialdir = "Y:\\commence\\updates", title = "Please select the destination directory")
|
| 36 |
|
|
replicateDest = os.path.splitdrive(replicateDest)[1]
|
| 37 |
|
|
print replicateDest
|
| 38 |
|
|
for x in appservers:
|
| 39 |
|
|
print "Now replicating to %s..."% x
|
| 40 |
|
|
if fullDir == "y":
|
| 41 |
|
|
shutil.copytree(os.path.dirname(replicateWhat),"//" + x + "/app" + os.path.splitext(replicateDest)[0])
|
| 42 |
|
|
else:
|
| 43 |
|
|
shutil.copy2(replicateWhat,"//" + x + "/app" + replicateDest)
|
| 44 |
|
|
|
| 45 |
|
|
def main():
|
| 46 |
|
|
if todo == 1:
|
| 47 |
|
|
remove()
|
| 48 |
|
|
if todo == 2:
|
| 49 |
|
|
move()
|
| 50 |
|
|
if todo == 3:
|
| 51 |
|
|
ReplicateOut()
|
| 52 |
|
|
|
| 53 |
|
|
|
| 54 |
|
|
if __name__ == '__main__':
|
| 55 |
|
|
main()
|