Difference between revisions of "Backup Help File"

From OpenCircuits
Jump to navigation Jump to search
(Created page with "This is the Help "file" for the Python Application whose main page is: Python Backup Program Help file for backup application. = Application Features = *Highly conf...")
 
 
(18 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
*Highly configurable.
 
*Highly configurable.
 
+
*Only copies new and updated files.
   
+
*Produces detailed and summary logs so you can know just what it did.
 +
*Once set up runs an update with a couple of clicks.
 +
*Recurse down a directory structure ( how far is configurable ).
 +
*Can select files with "file filters" For example only *.png and *.gif files.
 +
*GUI shows activity.
 +
*Can pause and resume.
 +
*Can set to throttle the backup so it does not degrade computer performance.
 +
*Directory structure, file names, file format preserved in backup.
 +
*Backup files may be inspected without need for a restore.
 +
*Can be set to simulate mode where you can see ( via the log files ) what would have been copied.
  
 
= Download and Install =  
 
= Download and Install =  
Line 42: Line 51:
  
 
= How To:... =  
 
= How To:... =  
 +
== Goal ==
 +
This is how I use the program, you could use it differently:
 +
 +
Put a short Python script in a directory.  When this is double clicked start the GUI for the backup program set up to backup the directory to another directory either on the current disk or another disk.
 +
 +
 
== General ==
 
== General ==
*Edit the parameter file:  Use the application button <Edit Parms> ( after configuring for your editor ) or any text editor suitable for Python ( no tabs ) on the file parameters.py.  See also: The section below, [[Configuration Files For Python]] and [[SmartPlug GUI Images]]
+
*Setup for backup of a directory.  See section below.
*View the log:  Use the application button ( after configuring for your editor ) or any text editor on the file smart_plug.py_log. This is the default file name, it can be changed in parameters.py.
 
*Create a new empty database:  There is a button on the graphing application.  First set the file name ( including full path ) to a non existent file.
 
 
*Record data/Monitor Plug: Press the <Record On> button, to stop  <Record Off> or close the application.  See also: [[SmartPlug GUI Images]].
 
  
*Set a timer: See also: [[SmartPlug GUI Images]]
+
*Edit the parameter file:  Use your development environment for Python or a text editor to edit parameters.py. See also: The section below, [[Configuration Files For Python]]. Normally I have a button on the GUI for this, but this function does not seem so useful for this application  
*See status/info on a smart plu: Of what, work in progress.
 
*Make a graph: Use the graphing application ... see section below. See also: [[SmartPlug GUI Images]].
 
  
 +
<!-----------
 +
this cannot bee seen
  
 +
 +
*View the log:  Use the application button ( after configuring for your editor ) or any text editor on the file smart_plug.py_log. This is the default file name, it can be changed in parameters.py.
 +
------------->
 
*Install: see section above.
 
*Install: see section above.
 +
 
*Debug:  see section below.
 
*Debug:  see section below.
*Change Parameters: Same as edit the parameter file.
+
 
*Retrieve data from plug: On the GUI, but not implemented.
+
*Quick Restart of the application:  Not in this app, just shutdown and restart.
*Quick Restart of the application:  As perhaps after a parameter change. Use the <Restart> button.  See also: [[SmartPlug GUI Images]]
+
 
*Turn plug on/off
 
 
*Use your preferred text editor. In the parameter file, see below.
 
*Use your preferred text editor. In the parameter file, see below.
== Graphing (Application) ==
 
*Save graph as .png file
 
*Zoom in on part of the graph
 
*Change the zero point ( time ) for the graph -- see parameters.py
 
*Move the graph lines around within the graph frame
 
*Choose what data to graph
 
*Change the units on the time scale of the graph -- see parameters.py
 
*Change the max and minimum values on the graph -- see parameters.py or zoom the graph
 
*Export a csv file: See also: [[SmartPlug GUI Images]]
 
  
How to Use the Parameter File =  
+
*Using the GUI see: [[Backup GUI]]
See: [[Configuration Files For Python]]
+
 
You need a text editor sutiable for .py files to manage the parameter file ( parameters.py )
+
== Setup for Backup ==
This includes most text editors.  I particularity like:
+
There are several different way to use the program, varying in part on how much you setup in parameters.py and how you structure your backups.  I generally set it up with a small program in the directory that I wish to backup, then to run the backup I go to that directory ( with a file manager ) and double click the file.  This is what I will describe here. There are a lot of small variations you can make to how you run it and locate the files, you can probably figure many of these out yourself.
 +
 
 +
=== Manually Configure the Backup ===
 +
 
 +
*Copy the file _sample_backup.py from your download of the program and drop it in the source directory.  Lets say the name of this is  ....../my_important_files.
 +
*Set up a backup location somewhere on your computer or network.  It should be named  ......./my_important_files.  You need to set up this directory manually because the backup program checks this name to make sure you do not backup to the wrong location by mistake.  Of course once this is setup it is done for good for that directory and backup configuration.
 +
*The application comes with some sample files to be backed up and a backup location for them.
 +
*For the rest of the setup read the file _sample_backup.py ( or your copy of it ) and then run it.
 +
*Look at the display in the GUI for the setting the program is using, and if Ok then run the backup. See: [[Backup GUI]] for more info on the GUI
 +
*After it has run take a look at the log files ( you can do this from the GUI once you configure parameters.py for your text editor of choice.
 +
*_sample_backup.py will run pretty much the same no matter where it is located on you disk, except you may find the python log file left in the directory with _sample_backup.py
 +
 
 +
=== Minimally Configure the Backup ===
  
*notepad++
+
*Edit parameters.py to default:
*geany
+
**default_name = {default name for the backup}     
 +
**log_detail_fn = {file name for the detailed log}
 +
**log_summary_fn = {file name for the summary log} 
 +
*Now look at the file _sample_backup_2.py for more documentation, pretty much all you have to set is the source and destination.
 +
*Program runs like _sample_backup.py, see above.
  
You can also use the editor that comes in many python development environments, the simplest of
+
=== No Configruation of Backup ===
which may be IdleBut there are many many othersIf you are reading this you probably have
+
In this mode the the location of the backup.py file determines the source directory and parameters.py computes a destinationIn my setup many files come from my D: drive and go to a network location rooted at I:\DataSo I use a method in the backup.py file to compute the destination......
some experience.
 
  
Once you configure an editor in parameters.py you can edit from the <Edit Parms> in the GUI ( see below )
+
Code in _sample_backup_3.py and the shipped parameters.py as  parameters.set_source_here() look at these files.
  
When editing there are couple of gotchas to watch out for.
+
=  How to Use the Parameter File =
* Python cares about capitalization, use the capitalization indicated in the default files and the example code.
+
See: '''[[Configuration Files For Python]]'''
* Python also cares a lot about how lines are indented.  Do not change the indentation from the sample files, and always indent using spaces ( not tabs. most text editors will use spaces automatically for .py files, even if you use the tab key )
 
  
 
Editing of the parameters.py file
 
Editing of the parameters.py file
  
*Edit so the program finds your devices.
 
 
**See above in Download and Install
 
**See above in Download and Install
 
*Enable your favorite editor to work with the application.
 
*Enable your favorite editor to work with the application.
Line 98: Line 116:
 
**Read the comments in parameters.py and change as desired.  If a setting does not work let me know.
 
**Read the comments in parameters.py and change as desired.  If a setting does not work let me know.
 
*If you mess up.
 
*If you mess up.
**Re download and get back to the original file.
+
**Re download and get back to the original parameter file.
 
 
= Working With Database Files =
 
 
 
* Create a directory for your data and database -- application comes with defaults
 
 
 
 
 
* Run database definition routine  button wf1
 
      You need to name a database, application will default
 
      You also need your sample file input, start with the one from
 
      the step above.
 
      look at output.......
 
 
 
 
 
 
 
 
  
 
= The GUI =
 
= The GUI =
  
see: [[SmartPlug GUI Images]]
+
see: [[Backup GUI Images]]
  
 
= Debugging =  
 
= Debugging =  
Line 125: Line 128:
 
* Watch the GUI
 
* Watch the GUI
 
* Check the Python console.
 
* Check the Python console.
* Look at the python log file ( use the GUI button <Edit Log> ( specify your editor in parameters.py first ) or use your editor on the default name of the log file ...\smart_plug\smart_plug.py_log.
+
* Look at the python log file ( use the GUI button <Edit Log> ( specify your editor in parameters.py first ) or use your editor on the default name of the log file ...\backup\backup.py_log.
  
 
Most issues will probably be missing libraries, parameters.py issues, or just bugs in my code (email me ).
 
Most issues will probably be missing libraries, parameters.py issues, or just bugs in my code (email me ).
 +
 +
If you are dropping you backup scripts around your disks and double clicking them you may need to tweak your path so python.exe or pythonw.exe is on your path.
  
 
<!-----------
 
<!-----------
Line 136: Line 141:
 
= Links =
 
= Links =
  
*[[Python Control of Smart Plugs]] main page for this project  
+
*[[Python Backup Program]] main page for this project  
 +
 
 +
*Click on category page for this project ( '''Python Backup''' ) below.
 +
*Click on '''What links here''' on the left of this page
  
*[[Category:Python_SmartPlug]] category page for this project
 
  
  
[[Category:Python SmartPlug]] [[category:Python]]
+
[[category:Python Backup]] [[category:Python]] [[category:Python Projects]]

Latest revision as of 10:06, 22 February 2020

This is the Help "file" for the Python Application whose main page is: Python Backup Program


Help file for backup application.


Application Features[edit]

  • Highly configurable.
  • Only copies new and updated files.
  • Produces detailed and summary logs so you can know just what it did.
  • Once set up runs an update with a couple of clicks.
  • Recurse down a directory structure ( how far is configurable ).
  • Can select files with "file filters" For example only *.png and *.gif files.
  • GUI shows activity.
  • Can pause and resume.
  • Can set to throttle the backup so it does not degrade computer performance.
  • Directory structure, file names, file format preserved in backup.
  • Backup files may be inspected without need for a restore.
  • Can be set to simulate mode where you can see ( via the log files ) what would have been copied.

Download and Install[edit]

There is really no install program. Currently the application is intended for those who have at least a little familiarity with Python coding and can just insert the downloaded code into their development environment and run it. Code not yet available.


How To:...[edit]

Goal[edit]

This is how I use the program, you could use it differently:

Put a short Python script in a directory. When this is double clicked start the GUI for the backup program set up to backup the directory to another directory either on the current disk or another disk.


General[edit]

  • Setup for backup of a directory. See section below.
  • Edit the parameter file: Use your development environment for Python or a text editor to edit parameters.py. See also: The section below, Configuration Files For Python. Normally I have a button on the GUI for this, but this function does not seem so useful for this application
  • Install: see section above.
  • Debug: see section below.
  • Quick Restart of the application: Not in this app, just shutdown and restart.
  • Use your preferred text editor. In the parameter file, see below.

Setup for Backup[edit]

There are several different way to use the program, varying in part on how much you setup in parameters.py and how you structure your backups. I generally set it up with a small program in the directory that I wish to backup, then to run the backup I go to that directory ( with a file manager ) and double click the file. This is what I will describe here. There are a lot of small variations you can make to how you run it and locate the files, you can probably figure many of these out yourself.

Manually Configure the Backup[edit]

  • Copy the file _sample_backup.py from your download of the program and drop it in the source directory. Lets say the name of this is ....../my_important_files.
  • Set up a backup location somewhere on your computer or network. It should be named ......./my_important_files. You need to set up this directory manually because the backup program checks this name to make sure you do not backup to the wrong location by mistake. Of course once this is setup it is done for good for that directory and backup configuration.
  • The application comes with some sample files to be backed up and a backup location for them.
  • For the rest of the setup read the file _sample_backup.py ( or your copy of it ) and then run it.
  • Look at the display in the GUI for the setting the program is using, and if Ok then run the backup. See: Backup GUI for more info on the GUI
  • After it has run take a look at the log files ( you can do this from the GUI once you configure parameters.py for your text editor of choice.
  • _sample_backup.py will run pretty much the same no matter where it is located on you disk, except you may find the python log file left in the directory with _sample_backup.py

Minimally Configure the Backup[edit]

  • Edit parameters.py to default:
    • default_name = {default name for the backup}
    • log_detail_fn = {file name for the detailed log}
    • log_summary_fn = {file name for the summary log}
  • Now look at the file _sample_backup_2.py for more documentation, pretty much all you have to set is the source and destination.
  • Program runs like _sample_backup.py, see above.

No Configruation of Backup[edit]

In this mode the the location of the backup.py file determines the source directory and parameters.py computes a destination. In my setup many files come from my D: drive and go to a network location rooted at I:\Data. So I use a method in the backup.py file to compute the destination......

Code in _sample_backup_3.py and the shipped parameters.py as parameters.set_source_here() look at these files.

How to Use the Parameter File[edit]

See: Configuration Files For Python

Editing of the parameters.py file

    • See above in Download and Install
  • Enable your favorite editor to work with the application.
    • self.ex_editor = r"D:\apps\Notepad++\notepad++.exe" # use r" or the backslashes will not work, or you can use forward slashes instead they may be wrong but they work.
  • Lots of other settings:
    • Read the comments in parameters.py and change as desired. If a setting does not work let me know.
  • If you mess up.
    • Re download and get back to the original parameter file.

The GUI[edit]

see: Backup GUI Images

Debugging[edit]

There are several application outputs that may be useful for debugging.

  • Watch the GUI
  • Check the Python console.
  • Look at the python log file ( use the GUI button <Edit Log> ( specify your editor in parameters.py first ) or use your editor on the default name of the log file ...\backup\backup.py_log.

Most issues will probably be missing libraries, parameters.py issues, or just bugs in my code (email me ).

If you are dropping you backup scripts around your disks and double clicking them you may need to tweak your path so python.exe or pythonw.exe is on your path.


Links[edit]

  • Click on category page for this project ( Python Backup ) below.
  • Click on What links here on the left of this page