#!/bin/bash
PGPASSWORD="dspace" pg_dump -U dspace -h localhost -Fc dspace | gzip > dspace_backup/dspace-$(date +%Y-%m-%d-%H.%M.%S).sql.gz
now=$(date +"%d_%m_%Y")
zip -r /home/koha/dspace_backup/$now-assetstore.zip /dspace/assetstore
#!/bin/bash
PGPASSWORD="dspace" pg_dump -U dspace -h localhost -Fc dspace | gzip > dspace_backup/dspace-$(date +%Y-%m-%d-%H.%M.%S).sql.gz
now=$(date +"%d_%m_%Y")
zip -r /home/koha/dspace_backup/$now-assetstore.zip /dspace/assetstore
If try to import large SQL (MySqL) file and take long lime or fail to work.
Try the bellow steps:
Create an 'Upload' and a 'save' directories for PhpMyadmin
mkdir /etc/phpmyadmin/upload
mkdir /etc/phpmyadmin/save
chmod a+w /etc/phpmyadmin/upload
chmod a+w /etc/phpmyadmin/save
Then edit phpmyadmin's config file:
sudo nano /etc/phpmyadmin/config.inc.php
add absolute path for both 'upload' and 'save' directories:
$cfg['UploadDir'] = '/etc/phpmyadmin/upload';
$cfg['SaveDir'] = '/etc/phpmyadmin/save';
$cfg['Servers'] [$i] ['LoginCookieValidity'] = 72000;
Now copy the koha_library.sql file to [
/etc/phpmyadmin/upload]
cp /your koha_library.sql file/ /etc/phpmyadmin/upload/
sudo chmod 777 /etc/phpmyadmin/upload/koha_library.sql
Timeout error in phpMyAdmin during import database from file
and
Open (search code using F6 in nano editor)
nano /usr/share/phpmyadmin/libraries/config.default.php
$cfg['ExecTimeLimit'] = 300; Make it to
$cfg['ExecTimeLimit'] = 0;
Restart Apache2
service apache2 restart
sudo -i
service mysql stop
killall -KILL mysql mysqld_safe mysqld
apt-get --yes purge mysql-server mysql-client
apt-get --yes autoremove --purge
apt-get autoclean
deluser --remove-home mysql
delgroup mysql
sudo rm -rf /var/lib/mysql
sudo apt-get remove --purge *mysql\*
sudo apt-get autoremove
sudo apt-get autoclean
Create a file called mysqldump.sh
mkdir /home/debian/backup/mysqldump.sh
copy the bellow line.
mysqldump -uroot -p******* koha_library | gzip > /home/debian/backup/koha_`date +%F`.sql.gz
save it
Test the script
chmod +x /home/debian/backup/mysqldump.sh
Create and schedule a new cron job
Execute the script:
sh /home/debian/backup/mysqldump.sh
And add the following line at the bottom of crontab -e
30 23 * * * /home/debian/backup/mysqldump.sh
(This will execute the script every day at 23:30.)
------------------------------PERIODIC REMOVAL OF FILES--------------------------
tested on Debian/UBUNTU
nano /home/debian/backup/mysqldump.sh
Add the line at the end: (this script will remove your Koha backfiles after 7 days)
find /home/debian/backup/koha* -type f -mtime +7 -exec rm {}
--------------------------Auto Restart Mysql service------------------------------------------
And add the following line at the bottom of crontab -e
30 23 * * * systemctl is-active || systemctl start mysql.service
This will run every midnight at 11.30PM
Login MySQL using mysql -u root -p CREATE USER 'superuser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGE...