Milí majitelé routerů Turris,
toto fórum bylo 9. 12. 2016 zmrazeno a nahrazeno naším novým Turris fórem. Ještě chvíli bude dostupné k prohlížení, ale již zde není možné přispívat. Více informací naleznete v oznámení o uzavření fóra.
Dear Turris routers users,
this forum has been frozen on Dec 9th, 2016 and replaced by our new Turris forum. It will be read-only accessible for some time after. For more information, read the announcement about closing the forum.
#!/bin/bash #define max number of backups stored, if more backups are found, the oldest ones get deleted export max_backups=500 export DATE=`date "+%Y-%m-%d_%H-%M-%S"` echo "Backup on " $DATE #put a count of packages installed into file echo `opkg list-installed | wc -l` "packages installed..." > /root/packages_installed.txt #put a list of packages into file opkg list-installed >> /root/packages_installed.txt #put disk free info into file df > /root/df.txt #pack /etc/ and /root/ tar cf - /etc/ | bzip2 > /tmp/backup_etc.tar.bz2 tar cf - /root/ | bzip2 > /tmp/backup_root.tar.bz2 #copy and timestamp backup files to permanent storage, keeping unstamped file in /tmp #file in /tmp will be overwritten in next script run cp /tmp/backup_etc.tar.bz2 /mnt/docs/backup/$DATE"_backup_etc.tar.bz2" cp /tmp/backup_root.tar.bz2 /mnt/docs/backup/$DATE"_backup_root.tar.bz2" #count backup files export files_count=`ls /mnt/docs/backup/|wc -l` #if more backups found, sort on creation date and remove oldest ones if [ "$files_count" -gt "$max_backups" ] then echo "Deleting old files" (ls -t|head -n $max_backups;ls)|sort|uniq -u|xargs rm fi
Powered by mwForum 2.29.3 © 1999-2013 Markus Wichitill