You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Modifications : 1.0.1 - Tidy up the comments and syntax
8
8
9
9
# Description : This will go through and backup all my automator services workflows
10
10
11
11
importshutil# Load the library module
12
12
importdatetime# Load the library module
13
-
importos# Load the library module
13
+
importos# Load the library module
14
14
15
-
today=datetime.date.today() # Get Today's date
16
-
todaystr=today.isoformat() # Format it so we can use the format to create the directory
15
+
today=datetime.date.today() # Get Today's date
16
+
todaystr=today.isoformat() # Format it so we can use the format to create the directory
17
17
18
-
confdir=os.getenv("my_config") # Set the variable by getting the value from the OS setting
19
-
dropbox=os.getenv("dropbox") # Set the variable by getting the value from the OS setting
20
-
conffile= ('services.conf') # Set the variable as the name of the configuration file
21
-
conffilename=os.path.join(confdir, conffile) # Set the variable by combining the path and the file name
22
-
sourcedir=os.path.expanduser('~/Library/Services/') # Source directory of where the scripts are located
23
-
destdir=os.path.join(dropbox, "My_backups"+"/"+"Automater_services"+todaystr+"/") # Combine several settings to create the destination backup directory
24
-
25
-
forfile_nameinopen(conffilename): # Walk through the configuration file
26
-
fname=file_name.strip() # Strip out the blank lines from the configuration file
27
-
iffname: # For the lines that are not blank
28
-
sourcefile=os.path.join(sourcedir, file_name.strip()) # Get the name of the source files to backup
29
-
destfile=os.path.join(destdir, file_name.strip()) # Get the name of the destination file names
30
-
shutil.copytree(sourcefile, destfile) # Copy the directories
18
+
confdir=os.getenv("my_config") # Set the variable by getting the value from the OS setting
19
+
dropbox=os.getenv("dropbox") # Set the variable by getting the value from the OS setting
20
+
conffile= ('services.conf') # Set the variable as the name of the configuration file
21
+
conffilename=os.path.join(confdir, conffile) # Set the variable by combining the path and the file name
22
+
sourcedir=os.path.expanduser('~/Library/Services/') # Source directory of where the scripts are located
23
+
destdir=os.path.join(dropbox, "My_backups"+"/"+"Automater_services"+todaystr+"/") # Combine several settings to create
24
+
25
+
# the destination backup directory
26
+
forfile_nameinopen(conffilename): # Walk through the configuration file
27
+
fname=file_name.strip() # Strip out the blank lines from the configuration file
28
+
iffname: # For the lines that are not blank
29
+
sourcefile=os.path.join(sourcedir, file_name.strip()) # Get the name of the source files to backup
30
+
destfile=os.path.join(destdir, file_name.strip()) # Get the name of the destination file names
31
+
shutil.copytree(sourcefile, destfile) # Copy the directories
defputty_sessions(): # Function to load the putty sessions I need
33
-
forserverinopen(conffilename): # Open the file server_list.txt, loop through reading each line - 1.1 -Changed - 1.3 Changed name to use variable conffilename
34
-
subprocess.Popen(('putty -load '+server)) # Open the PuTTY sessions - 1.1
33
+
defputty_sessions(): # Function to load the putty sessions I need
34
+
forserverinopen(conffilename): # Open the file server_list.txt, loop through reading each line - 1.1 -Changed - 1.3 Changed name to use variable conffilename
35
+
subprocess.Popen(('putty -load '+server)) # Open the PuTTY sessions - 1.1
35
36
36
37
defrdp_sessions():
37
38
print"Loading RDP Sessions:"
38
-
subprocess.Popen("mstsc eclr.rdp") # Open up a terminal session connection and load the euroclear session
39
+
subprocess.Popen("mstsc eclr.rdp") # Open up a terminal session connection and load the euroclear session
39
40
40
41
defeuroclear_docs():
41
42
# The command below opens IE and loads the Euroclear password document
@@ -44,15 +45,20 @@ def euroclear_docs():
44
45
# End of the functions
45
46
46
47
# Start of the Main Program
48
+
defmain():
49
+
filename=sys.argv[0] # Create the variable filename
50
+
confdir=os.getenv("my_config") # Set the variable confdir from the OS environment variable - 1.3
51
+
conffile= ('daily_checks_servers.conf') # Set the variable conffile - 1.3
52
+
conffilename=os.path.join(confdir, conffile) # Set the variable conffilename by joining confdir and conffile together - 1.3
53
+
clear_screen() # Call the clear screen function
54
+
55
+
# The command below prints a little welcome message, as well as the script name, the date and time and where it was run from.
0 commit comments