@mwittig we could implement that as a driver. https://github.com/google/google-api-nodejs-client
I’ll give it a try when I have more time.
pimatic-backup
@mwittig we could implement that as a driver. https://github.com/google/google-api-nodejs-client
I’ll give it a try when I have more time.
Hi @sweebee,
Thanks for this, good initiative !
Sugestion: What about providing a rule action, so users can leverage datetime and cron for more flexibility as to when the backups are scheduled.
Although the plugin currently backs up the config, I am already thinking about the power of the plugin: For plugin scalability, the drivers could become devices holding backup parameters (e.g. combined with a resource file on what to backup read by the device). What do you think?
Pimatic-Telegram already is capable of sending files (documents) to a telegram client, for the config backup this could also work.
Also I still have a solid shell script lying around using rsync for backups on the (local) network.
If time permits I wouldn’t mind migrating the backup script etc to a driver and optionally integrating p-telegram, although I am currently working heavily on the TTS plugin. Please let me know your thoughts.
"Screw the captain. It's the engineer running the ship!"
pimatic-telegram, pimatic-tts, pimatic-woox, pimatic-lg-smart-tv, pimatic-spotify, pimatic-wakeuplight and some not-announced plugins
@dan said in pimatic-backup:
Thanks for this, good initiative !
I like the idea of implementing backup drivers as pimatic devices. As you say, it also provides the opportunity to utilize device types implemented by different plugins. Implementing a backup action provider also allows for handling other sources than pimatic config file if fancied.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
I tried setting up a bunch of rules to send a backup on email, but I get an empty file. I suspect my email conf is wrong or the file can’t be found
@sweebee said in pimatic-backup:
@mwittig we could implement that as a driver. https://github.com/google/google-api-nodejs-client
I’ll give it a try when I have more time.
Another option maybe is dropbox ?
@bill-blacksoll said in pimatic-backup:
Another option maybe is dropbox ?
+1
Dropbox should be on the list of supported drivers!
However, I think the driver should be possibly written in Javascript/Coffeescript rather than embedding a bash script, e.g. https://www.npmjs.com/package/dropbox
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Maybe it is possible to use some other programs like https://rclone.org/ to connect to different clouds storages. But I really don’t know if this is possible. It is just an idea to make a backup possible to many different services.
Hello, I would like to know how to spell the path in the settings. With “/” at the beginning and with "/"at the end?
Thx for help.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
@thrusty
I have almost the same questions, but It seams nobody care. I will try it anyway.
Does somebody have a clou what is the problem here?
error [pimatic-backup]: { [Error: pimaticbackup/12/14/2019, 7:48:04 PM.json: No such file or directory] code: 550 }
pimatic version 0.9.54
Node.js version 4.9.1
npm version 2.15.12
Quickly scanned the code of pimatic-backup.
@client.put data, @options.path + slash + name, (err) =>
if err
env.logger.error err
else
env.logger.debug "Backup created"
Seems the code assumes the target path already exists and is valid.
pimaticbackup/12/14/2019, 7:48:04 PM
thats definately not a valid *nix path"Screw the captain. It's the engineer running the ship!"
pimatic-telegram, pimatic-tts, pimatic-woox, pimatic-lg-smart-tv, pimatic-spotify, pimatic-wakeuplight and some not-announced plugins
Till Dropbox option became available I use the following rule and works great.
Backup_every_sunday
When it is 0:00 and it is sunday then send mail to:"..........@gmail.com" subject:"Pimatic config backup" file:"/home/pi/pimatic-app/config.json" from:".......@gmail.com" text:"Pimatic config backup"
Database backup
When DB Backup is pressed then send mail to:"........@gmail.com" subject:"Pimatic db backup" html:"{date()}" file:"/home/pi/pimatic-app/pimatic-database.sqlite"
@dan said in pimatic-backup:
- if it is something like
pimaticbackup/12/14/2019, 7:48:04 PM
thats definately not a valid *nix path
Might actually be localization bug on date/timestamp. Then @sweebee needs to look into this.
"Screw the captain. It's the engineer running the ship!"
pimatic-telegram, pimatic-tts, pimatic-woox, pimatic-lg-smart-tv, pimatic-spotify, pimatic-wakeuplight and some not-announced plugins
@dan said in pimatic-backup:
Quickly scanned the code of pimatic-backup.
@client.put data, @options.path + slash + name, (err) => if err env.logger.error err else env.logger.debug "Backup created"
Seems the code assumes the target path already exists and is valid.
- What path did you configure for your backups in the plugin?
- if it is something like
pimaticbackup/12/14/2019, 7:48:04 PM
thats definately not a valid *nix path- Did you create the path on the target machine?
No thats not the path. My path is a folder on my drive and the name is pimaticbackup so my path is “pimaticbackup/”
Yes, I created an extra folder for pimatic backups.
The date and time is from the backup I would say.
I’ve seen on github there was an issue with the timestamp in the coffee.skript. Could this be a reason why the date and time is display in the path?
https://github.com/sweebee/pimatic-backup/issues/1
@bill-blacksoll said in pimatic-backup:
Till Dropbox option became available I use the following rule and works great.
Backup_every_sunday
When it is 0:00 and it is sunday then send mail to:"..........@gmail.com" subject:"Pimatic config backup" file:"/home/pi/pimatic-app/config.json" from:".......@gmail.com" text:"Pimatic config backup"
Database backup
When DB Backup is pressed then send mail to:"........@gmail.com" subject:"Pimatic db backup" html:"{date()}" file:"/home/pi/pimatic-app/pimatic-database.sqlite"
I would like to save it on my NAS. But just in case, how do you do that to save cfg and database on dropbox?
@dnl0319 I’m using dropbox_uploader to save Pimatic backups and stills from my cameras. Its a bash script that via shell-execute can be used in rules in Pimatic. It’s not fancy but it works without problems for 2 years.
@bertreb said in pimatic-backup:
@dnl0319 I’m using dropbox_uploader to save Pimatic backups and stills from my cameras. Its a bash script that via shell-execute can be used in rules in Pimatic. It’s not fancy but it works without problems for 2 years.
Okay that sounds nice. When this works with dropbox this could work also for NAS (FTP) with a script? As I said I’m looking for an option to backup cfg and database on my NAS.
Dropbox_uploader is specially made for dropbox up/downloading. For a local NAS backup you would need something else. The pimatic-backup plugin should work with probably some patching/rewriting.
I installed pimatic new. And still got the following errors.
I think there is something wrong in the plugin:
Pimatic version: 0.9.54
node version: 10.16.3
The path that I’ve set up in the plugin is “pimaticbiackup/test/”
{
"debug": true,
"interval": 12,
"driver": "FTP",
"driverOptions": {
"host": "XXX.XXX.XXX.XXX",
"port": 21,
"username": "xxx"
"password": "xxx"
"path": "pimaticbackup/test/"
},
"plugin": "backup",
"active": true
},
Here is the error:
error [pimatic-backup]: { Error: pimaticbackup/test/1/13/2020, 5:52:21 PM.json: No such file or directory
at makeError (/home/pi/pimatic-app/node_modules/pimatic-backup/node_modules/ftp/lib/connection.js:1067:13)
at Parser.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic-backup/node_modules/ftp/lib/connection.js:113:25)
at Parser.emit (events.js:198:13)
at Parser._write (/home/pi/pimatic-app/node_modules/pimatic-backup/node_modules/ftp/lib/parser.js:59:10)
at doWrite (_stream_writable.js:415:12)
at writeOrBuffer (_stream_writable.js:399:5)
at Parser.Writable.write (_stream_writable.js:299:11)
at Socket.ondata (/home/pi/pimatic-app/node_modules/pimatic-backup/node_modules/ftp/lib/connection.js:273:20)
at Socket.emit (events.js:198:13)
at Socket.emit (/home/pi/pimatic-app/node_modules/pimatic/startup.coffee:64:24)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 550 }
Hi, the first line of the error indicates a missing directory. I think the plugin (the used ftp library) doesn’t creates directories. When using year/month/day to structure backup, you need automatic creation of subdirectories, otherwise is will be be very much work to prepare the backup directories.
Does backup to the main directory (pimaticbackup/test) work?
@bertreb said in pimatic-backup:
Hi, the first line of the error indicates a missing directory. I think the plugin (the used ftp library) doesn’t creates directories. When using year/month/day to structure backup, you need automatic creation of subdirectories, otherwise is will be be very much work to prepare the backup directories.
Does backup to the main directory (pimaticbackup/test) work?
But why should the plugin create this kind of structure? that makes no sense. I could understand if the strike is like “year/month/day”. A friend of mine uses the same backup plugin with the same pimatic version and node version and on his pimatic the backup plugin works and there is no file structure that has been created.
No the backup never work with my pimatic.
@dnl0319 i looked a little deeper into the plugin and the used ftp library creates the year/month/day directories, as part of the functionality. So thats not something you have to do.
Another reason for this error could be the write permission in your ftp server.
The used username should have permission to write files and create directories.