I had the honour to help Bernie_O with some translation of documentation for the newest release of this backup script which I find really useful.
But I am writing this to point out to the fact that calcardbackupdoes not need cleartext passwords (nor usernames) anymore, since it fetches all data directly from the database now. So thereâs no security issue anymore to use the script, which at least to me is a better feeling to have backup and security both.
Thanks a lot Bernie_O for your constant work on this script!
@Bernie_O
You linked me to this thread.
Iâm currently trying to extract the data from a backup set and it seems your script is pulling data only from the running instance.
I decompressed the backup to the â/var/tmp/workcloudâ and changed the settings like this.
This ist the output of your script, but when checking the contents of the ics, I have the content of the currently running nextcloud 15.0.4 database. Did I miss something?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ Sat Feb 16 12:08:12 CET 2019 â START calcardbackup ver. 0.8.6 (13.02.2019), AGPL-3.0
+ Checking dependencies and preparingâŚ
+ no usersfile given: will backup all available items.
+ Using URL: http://localhost
+ no valid status.php found at http://localhost.
+ Nextcloud 14.0.4 detected.
+ Database of chosen Nextcloud installation is MySQL/MariaDB.
+ Looking for calendars in your Nextcloud:
+ saving calendar ncpadmin-Personal.ics (from database)âŚsuccess!
+ saving calendar user1-Personal.ics (from database)âŚsuccess!
+ saving calendar user2-Personal.ics (from database)âŚsuccess!
+ Looking for calendarsubscriptions in your Nextcloud:
+ No calendarsubscriptions found.
+ Looking for addressbooks in your Nextcloud:
+ saving addressbook ncpadmin-Contacts.vcf (from database)âŚempty file. Addressbook âContactsâ of user âncpadminâ is empty.
+ saving addressbook system_system-system.vcf (from database)âŚsuccess!
+ saving addressbook user1-Contacts.vcf (from database)âŚempty file. Addressbook âContactsâ of user âKarinâ is empty.
+ saving addressbook user2-Contacts.vcf (from database)âŚsuccess!
+ Compressing backup as *.tar.gz file. Be patient - this may take a while.
+ Backup successfully compressed!
+ Find your backup here: /var/tmp/calcardbackup/calcardbackup/backups/calcardbackup-2019-02-16.tar.gz
+ Sat Feb 16 12:08:14 CET 2019 â END calcardbackup
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Your config.php from /var/tmp/workcloud is pointing to the database of your new installation.
Do you have a backup of the database your old installation was using? Or did you only backup the nextcloud folder (including the data folder)?
Can you tell me where you can see:
âYour config.php from /var/tmp/workcloud is pointing to the database of your new installation.â
I have a file called nextcloud-sqlbkp_20190210.bak that was unpacked from the backup, but I donât know how to use that.
I guess itâs the sql dump.
Here are some of the last lines (human readable):
-- Dumping data for table `oc_whats_new`
--
LOCK TABLES `oc_whats_new` WRITE;
/*!40000 ALTER TABLE `oc_whats_new` DISABLE KEYS */;
/*!40000 ALTER TABLE `oc_whats_new` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-10 10:04:49
I canât see that, but you said, that the script is pulling data from the running instance and my script is using the credentials from config.php, so obviously your config.php is pointing to the database of your new installation.
Good you have a database dump. It should be not a big problem to restore the calendars. Replace [DBPASSWORD] with the according value in config.php from your old installation and make sure that there is no space between -p and [DBPASSWORD]:
create a new database (e.g. called âworkcloudâ) with:
EDIT: make sure there is no database called âworkcloudâ in your database - or choose a different name in the following commands.
mysql -u ncadmin -p[DBPASSWORD] -e "CREATE DATABASE workcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
import your MySQL-dump (issue this command from the folder where your MySQL-dump resides):
mysql -u ncadmin -p[DBPASSWORD] workcloud < nextcloud-sqlbkp_20190210.bak
run calcardbackup like you did before
have a look the .ics files calcardbackup created
if the calendars arenât the ones from your old installation, write again in this thread
if you got the calendars from your old installation you can delete the database again with:
mysql -u ncadmin -p[DBPASSWORD] -e "DROP DATABASE workcloud;"
Setting up the new database gives me error.
Copied the passphrase from the old config.php (itâs the same like the one from the active instance, by the way)
root@bananapim2:/var/tmp/workcloud/config# mysql -u ncadmin -pblablablalbalikethis -e "CREATE DATABASE workcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
ERROR 1044 (42000) at line 1: Access denied for user 'ncadmin'@'localhost' to database 'workcloud'
Hm⌠Sorry - I am not very familiar with the code of nextcloudpi.
You need to issue those commands then as the mysql root user.
You can try to issue the commands with sudo and leaving out option -u and -p so that the commands start like this (you probably will be asked for a password - enter the one you use when logging in via ssh):
sudo mysql -e "CREATE DATABASE workcloud [...] "
If this doesnât work - @nachoparker has to help here for how gain access to mysql as the mysql root-user to create a temporary table for this purpose.
I issued both commands without -u and -p, as root user.
The calcardbackup is still exporting the nextcloud contents only.
This is the current list of databases:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| MyMusic60 |
| MyVideos107 |
| information_schema |
| mysql |
| nextcloud |
| performance_schema |
| workcloud |
+--------------------+
7 rows in set (0.00 sec)
I am using Ubuntu and MySQL. After I installed the MySQL client from repo I get now this error:
Looking for calendars in your Nextcloud:
ERROR 2002 (HY000): Canât connect to local MySQL server through socket â/var/run/mysqld/mysqld.sockâ (2)
The folder/file â/var/run/mysqld/mysqld.sockâ does not exist on my system.
Maybe important: I am using XAMPP/LAMPP for running my nextcloud instance.
It may be worth to take a look at vdirsyncer. It syncs calendar/card data from a server (e.g. nextcloud) to local files/folders.
And it can perform 2-way sync, so you can use other tools on your local files and the changes will be synched back.
vdirsyncer and calcardbackup have quite different use cases:
vdirsyncer syncronizes calendars/addressbooks of a single user. A single username/password combination must be given in a configuration file.
calcardbackup is meant as a backup solution for every single calendar and addressbook found in the database of Nextcloud/ownCloud without the need to give any usernames or passwords.