{"id":333275,"date":"2022-05-18T03:00:10","date_gmt":"2022-05-18T03:00:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=333275"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=333275","title":{"rendered":"<span>\u041f\u0440\u043e\u0441\u0442\u044b\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u044d\u043a\u0430\u043f\u044b \u0432 Linux \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TAR \u0438 GPG<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u0434\u0435\u043b\u0430\u044e \u0431\u044d\u043a\u0430\u043f\u044b \u0432 Linux<\/p>\n<p>\u041e\u0431\u043e\u0436\u0430\u044e UNIX-way, \u0442\u0443\u0442 \u0431\u044d\u043a\u0430\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u0430 home \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 tar \u0441 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0438  \u0448\u0438\u0444\u0440\u0443\u044e \u0435\u0433\u043e \u0441\u0432\u043e\u0438\u043c gpg \u043a\u043b\u044e\u0447\u043e\u043c.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u043e\u0432 \u043c\u043e\u0438\u0445 \u0432\u0438\u0434\u0435\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f  \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0434\u043b\u044f \u044e\u0442\u0443\u0431\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e rsync. RSYNC \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash NOW=$(date +%Y%m%d%H%M) MNOW=$(date +%Y%m) BACKUP_HOME=\"\/tmp\/home\/\" EMAIL=\"devpew\" ARCHIVES_DIR=\"\/tmp\/backup\/\" DOW=date +%a              # Day of the week e.g. Mon DOM=date +%d              # Date of the Month e.g. 27 DM=date +%d%b             # Date and Month e.g. 27Sep if [[ ! -d \" class=\"formula inline\">{MNOW} ]] then mkdir \" class=\"formula inline\">{MNOW} else echo &amp;>\/dev\/null fi tar --exclude-from=\/home\/dm\/mybin\/.backup.excludes -v -z --create --file \" class=\"formula inline\">{MNOW}\/\" class=\"formula inline\">{ARCHIVES_DIR}\" class=\"formula inline\">{MNOW}.snar \" class=\"formula inline\">{ARCHIVES_DIR}\" class=\"formula inline\">{NOW}.log if [ -d \" class=\"formula inline\">{ARCHIVES_DIR}-l) != \"0\" ] then\u0418  gpg -r \" class=\"formula inline\">EMAIL --encrypt-files \" class=\"formula inline\">{MNOW}\/.tar.gz  &amp;&amp; rm -rf \" class=\"formula inline\">{MNOW}\/.tar.gz fi scp \" class=\"formula inline\">{MNOW}\/\" class=\"formula inline\">{ARCHIVES_DIR}\" class=\"formula inline\">{MNOW}.snar dm@192.168.0.152:\/home\/dm\/backup\/${MNOW}<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u043d\u0435\u0434\u0435\u043b\u044f\u043c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/p>\n<pre><code class=\"bash\">DOW=`date +%a`              # Day of the week e.g. Mon DOM=`date +%d`              # Date of the Month e.g. 27 DM=`date +%d%b`             # Date and Month e.g. 27Sep  if [ $DOM = \"01\" ]; then   echo 'this is monthly backup' fi    if [ $DOW = \"Sun\" ]; then   echo 'this is weekly backup' else   echo 'this is daily backup' fi  <\/code><\/pre>\n<h3>HOW IT WORKS<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442<\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0431\u0435\u043a\u0430\u043f\u043e\u0432 \u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0432 \u043d\u0435\u0439  \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0433\u043e\u0434\u0430 \u0438 \u043c\u0435\u0441\u044f\u0446\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u201c202205\u201d \u0435\u0441\u043b\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u0430\u0439  2022 \u0433\u043e\u0434\u0430.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u0431\u044d\u043a\u0430\u043f\u044b \u0437\u0430 \u043c\u0430\u0439 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0435\u0441\u043b\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 \u043d\u0435\u0442 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435  \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0441\u044f\u0446) \u0442\u043e \u0443 \u043d\u0430\u0441 \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439  \u0431\u0435\u043a\u0430\u043f \u0432\u0441\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>\u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0431\u0435\u043a\u0430\u043f\u0430<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u0441 \u043b\u043e\u0433\u043e\u043c<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0441\u0434\u0435\u043b\u0430\u043b\u0441\u044f \u0431\u0435\u043a\u0430\u043f, \u043e\u043d \u0443 \u043d\u0430\u0441 \u0437\u0430\u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0448\u0438\u043c GPG \u043a\u043b\u044e\u0447\u043e\u043c \u0430 \u0444\u0430\u0439\u043b TAR \u0443\u0434\u0430\u043b\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u0431\u044d\u043a\u0430\u043f \u043a \u043d\u0430\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<h3>Exclude<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438\u043b\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435  \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0435\u043a\u0430\u043f\u0438\u0442\u044c, \u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0422\u0443\u0442  \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c, \u043b\u044e\u0431\u043e\u0439 \u043b\u0438\u0448\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u0435\u043b \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0435 \u0441\u043b\u043e\u043c\u0430\u0442\u044c<\/p>\n<pre><code class=\"coffeescript\">\u279c  mybin cat \/home\/dm\/mybin\/.backup.excludes \/tmp\/home\/Nextcloud \/tmp\/home\/.cache \/tmp\/home\/youtube-videos<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435 \u0441\u043b\u044d\u0448 \u0432 \u043a\u043e\u043d\u0446\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0430 <code>\/tmp\/home\/Nextcloud<\/code> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0430 \u0432\u043e\u0442 \u0441\u0442\u0440\u043e\u043a\u0430 <code>\/tmp\/home\/Nextcloud\/<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0422\u0430\u043a \u0447\u0442\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b<\/p>\n<h3>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c<\/h3>\n<p>\u0423 \u043d\u0430\u0441 \u0434\u0435\u043b\u0430\u044e\u0442\u0441\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0435\u043a\u0430\u043f\u044b \u0438 \u0448\u0438\u0444\u0440\u0443\u044e\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<p>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<pre><code class=\"css\">gpg --output 202205122134.tar.gz --decrypt 202205122134.tar.gz.gpg<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c tar \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430.<\/p>\n<pre><code class=\"javascript\">tar --extract --verbose --listed-incremental=\/dev\/null --file=202205010101.tar.gz<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u044b, \u0435\u0441\u043b\u0438  \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 11 \u0447\u0438\u0441\u043b\u043e, \u0442\u043e \u043d\u0443\u0436\u043d\u043e  \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c tar-\u0430\u0440\u0445\u0438\u0432\u044b \u0441\u043e 2 \u043f\u043e 11 \u0432 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043f\u043a\u0443<\/p>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0438 \u0432\u044b \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0435  \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,  \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439.<\/p>\n<p>\u0418\u043b\u0438 \u0435\u0441\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u0432\u0430\u0441 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c,  \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043a\u0438\u0434\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0438. \u0412 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435  \u0442\u0430\u043a:<\/p>\n<pre><code class=\"css\">tar --extract --incremental --file file0.tar tar --extract --incremental --file file1.tar tar --extract --incremental --file file2.tar<\/code><\/pre>\n<p>\u0418\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">for i in *.tbz2; do tar -xjGf \"$i\"; done;<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e  \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u043e\u043b\u044c\u043a\u043e  \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438  \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430:<\/p>\n<pre><code class=\"nginx\">tar -xjGf levelX.tar --wildcards 'example\/foo*' 'example\/bar*'<\/code><\/pre>\n<h3>Autorun<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0432 \u0443\u0431\u0443\u043d\u0442\u0435 \u0438\u043b\u0438 \u0434\u0435\u0431\u0438\u0430\u043d\u0435, \u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u043f\u0438\u0442  \u0447\u0435\u0440\u0435\u0437 \u043a\u0440\u043e\u043d. \u0412 \u0430\u0440\u0447\u0435 \u043d\u0435\u0442 \u043a\u0440\u043e\u043d\u0430 \u0438 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0430\u0447\u0435. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435  \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0432 03:30<\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<pre><code class=\"nginx\">sudo nvim \/usr\/lib\/systemd\/system\/backup.service<\/code><\/pre>\n<pre><code>[Unit] Description=backup  [Service] Type=simple ExecStart=\/home\/dm\/mybin\/backup<\/code><\/pre>\n<p>\u0418 \u0444\u0430\u0439\u043b<\/p>\n<pre><code class=\"nginx\">sudo nvim \/usr\/lib\/systemd\/system\/backup.timer<\/code><\/pre>\n<pre><code>[Unit] Description=my backup  [Timer] OnCalendar=*-*-* 03:30:00  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441<\/p>\n<pre><code class=\"css\">sudo systemctl start backup.timer sudo systemctl enable backup.timer<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043b\u0438 \u043e\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<pre><code>sudo systemctl list-timers --all<\/code><\/pre>\n<p>\u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<pre><code class=\"css\">sudo systemctl status backup.timer<\/code><\/pre>\n<h3>REMOVE OLD BACKUPS<\/h3>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u044d\u043a\u0430\u043f\u044b, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435  \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0431\u0438\u0442\u044c \u0432\u0441\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f  \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c, \u0430 \u044f \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u0441\u044e\u0434\u0430 \u0432\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/666292\/\"> https:\/\/habr.com\/ru\/post\/666292\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u0434\u0435\u043b\u0430\u044e \u0431\u044d\u043a\u0430\u043f\u044b \u0432 Linux<\/p>\n<p>\u041e\u0431\u043e\u0436\u0430\u044e UNIX-way, \u0442\u0443\u0442 \u0431\u044d\u043a\u0430\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u0430 home \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 tar \u0441 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0438  \u0448\u0438\u0444\u0440\u0443\u044e \u0435\u0433\u043e \u0441\u0432\u043e\u0438\u043c gpg \u043a\u043b\u044e\u0447\u043e\u043c.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u043e\u0432 \u043c\u043e\u0438\u0445 \u0432\u0438\u0434\u0435\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f  \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0434\u043b\u044f \u044e\u0442\u0443\u0431\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e rsync. RSYNC \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash NOW=$(date +%Y%m%d%H%M) MNOW=$(date +%Y%m) BACKUP_HOME=\"\/tmp\/home\/\" EMAIL=\"devpew\" ARCHIVES_DIR=\"\/tmp\/backup\/\" DOW=date +%a              # Day of the week e.g. Mon DOM=date +%d              # Date of the Month e.g. 27 DM=date +%d%b             # Date and Month e.g. 27Sep if [[ ! -d \" class=\"formula inline\">{MNOW} ]] then mkdir \" class=\"formula inline\">{MNOW} else echo &amp;>\/dev\/null fi tar --exclude-from=\/home\/dm\/mybin\/.backup.excludes -v -z --create --file \" class=\"formula inline\">{MNOW}\/\" class=\"formula inline\">{ARCHIVES_DIR}\" class=\"formula inline\">{MNOW}.snar \" class=\"formula inline\">{ARCHIVES_DIR}\" class=\"formula inline\">{NOW}.log if [ -d \" class=\"formula inline\">{ARCHIVES_DIR}-l) != \"0\" ] then\u0418  gpg -r \" class=\"formula inline\">EMAIL --encrypt-files \" class=\"formula inline\">{MNOW}\/.tar.gz  &amp;&amp; rm -rf \" class=\"formula inline\">{MNOW}\/.tar.gz fi scp \" class=\"formula inline\">{MNOW}\/\" class=\"formula inline\">{ARCHIVES_DIR}\" class=\"formula inline\">{MNOW}.snar dm@192.168.0.152:\/home\/dm\/backup\/${MNOW}<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u0439 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u043d\u0435\u0434\u0435\u043b\u044f\u043c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/p>\n<pre><code class=\"bash\">DOW=`date +%a`              # Day of the week e.g. Mon DOM=`date +%d`              # Date of the Month e.g. 27 DM=`date +%d%b`             # Date and Month e.g. 27Sep  if [ $DOM = \"01\" ]; then   echo 'this is monthly backup' fi    if [ $DOW = \"Sun\" ]; then   echo 'this is weekly backup' else   echo 'this is daily backup' fi  <\/code><\/pre>\n<h3>HOW IT WORKS<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442<\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0431\u0435\u043a\u0430\u043f\u043e\u0432 \u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0432 \u043d\u0435\u0439  \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0433\u043e\u0434\u0430 \u0438 \u043c\u0435\u0441\u044f\u0446\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u201c202205\u201d \u0435\u0441\u043b\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u0430\u0439  2022 \u0433\u043e\u0434\u0430.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u0431\u044d\u043a\u0430\u043f\u044b \u0437\u0430 \u043c\u0430\u0439 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0435\u0441\u043b\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 \u043d\u0435\u0442 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435  \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0441\u044f\u0446) \u0442\u043e \u0443 \u043d\u0430\u0441 \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439  \u0431\u0435\u043a\u0430\u043f \u0432\u0441\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>\u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0431\u0435\u043a\u0430\u043f\u0430<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u0441 \u043b\u043e\u0433\u043e\u043c<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0441\u0434\u0435\u043b\u0430\u043b\u0441\u044f \u0431\u0435\u043a\u0430\u043f, \u043e\u043d \u0443 \u043d\u0430\u0441 \u0437\u0430\u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0448\u0438\u043c GPG \u043a\u043b\u044e\u0447\u043e\u043c \u0430 \u0444\u0430\u0439\u043b TAR \u0443\u0434\u0430\u043b\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u0431\u044d\u043a\u0430\u043f \u043a \u043d\u0430\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<h3>Exclude<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438\u043b\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435  \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0435\u043a\u0430\u043f\u0438\u0442\u044c, \u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0422\u0443\u0442  \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c, \u043b\u044e\u0431\u043e\u0439 \u043b\u0438\u0448\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u0435\u043b \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0435 \u0441\u043b\u043e\u043c\u0430\u0442\u044c<\/p>\n<pre><code class=\"coffeescript\">\u279c  mybin cat \/home\/dm\/mybin\/.backup.excludes \/tmp\/home\/Nextcloud \/tmp\/home\/.cache \/tmp\/home\/youtube-videos<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435 \u0441\u043b\u044d\u0448 \u0432 \u043a\u043e\u043d\u0446\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0430 <code>\/tmp\/home\/Nextcloud<\/code> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0430 \u0432\u043e\u0442 \u0441\u0442\u0440\u043e\u043a\u0430 <code>\/tmp\/home\/Nextcloud\/<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0422\u0430\u043a \u0447\u0442\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b<\/p>\n<h3>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c<\/h3>\n<p>\u0423 \u043d\u0430\u0441 \u0434\u0435\u043b\u0430\u044e\u0442\u0441\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0435\u043a\u0430\u043f\u044b \u0438 \u0448\u0438\u0444\u0440\u0443\u044e\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<p>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<pre><code class=\"css\">gpg --output 202205122134.tar.gz --decrypt 202205122134.tar.gz.gpg<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c tar \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430.<\/p>\n<pre><code class=\"javascript\">tar --extract --verbose --listed-incremental=\/dev\/null --file=202205010101.tar.gz<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u044b, \u0435\u0441\u043b\u0438  \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 11 \u0447\u0438\u0441\u043b\u043e, \u0442\u043e \u043d\u0443\u0436\u043d\u043e  \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c tar-\u0430\u0440\u0445\u0438\u0432\u044b \u0441\u043e 2 \u043f\u043e 11 \u0432 \u0442\u0443 \u0436\u0435 \u043f\u0430\u043f\u043a\u0443<\/p>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0438 \u0432\u044b \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0435  \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,  \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439.<\/p>\n<p>\u0418\u043b\u0438 \u0435\u0441\u043b\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u0432\u0430\u0441 \u044d\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c,  \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043a\u0438\u0434\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0438. \u0412 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435  \u0442\u0430\u043a:<\/p>\n<pre><code class=\"css\">tar --extract --incremental --file file0.tar tar --extract --incremental --file file1.tar tar --extract --incremental --file file2.tar<\/code><\/pre>\n<p>\u0418\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">for i in *.tbz2; do tar -xjGf \"$i\"; done;<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e  \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u043e\u043b\u044c\u043a\u043e  \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438  \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430:<\/p>\n<pre><code class=\"nginx\">tar -xjGf levelX.tar --wildcards 'example\/foo*' 'example\/bar*'<\/code><\/pre>\n<h3>Autorun<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0432 \u0443\u0431\u0443\u043d\u0442\u0435 \u0438\u043b\u0438 \u0434\u0435\u0431\u0438\u0430\u043d\u0435, \u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u043f\u0438\u0442  \u0447\u0435\u0440\u0435\u0437 \u043a\u0440\u043e\u043d. \u0412 \u0430\u0440\u0447\u0435 \u043d\u0435\u0442 \u043a\u0440\u043e\u043d\u0430 \u0438 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0430\u0447\u0435. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435  \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0432 03:30<\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<pre><code class=\"nginx\">sudo nvim \/usr\/lib\/systemd\/system\/backup.service<\/code><\/pre>\n<pre><code>[Unit] Description=backup  [Service] Type=simple ExecStart=\/home\/dm\/mybin\/backup<\/code><\/pre>\n<p>\u0418 \u0444\u0430\u0439\u043b<\/p>\n<pre><code class=\"nginx\">sudo nvim \/usr\/lib\/systemd\/system\/backup.timer<\/code><\/pre>\n<pre><code>[Unit] Description=my backup  [Timer] OnCalendar=*-*-* 03:30:00  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441<\/p>\n<pre><code class=\"css\">sudo systemctl start backup.timer sudo systemctl enable backup.timer<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043b\u0438 \u043e\u043d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<pre><code>sudo systemctl list-timers --all<\/code><\/pre>\n<p>\u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<pre><code class=\"css\">sudo systemctl status backup.timer<\/code><\/pre>\n<h3>REMOVE OLD BACKUPS<\/h3>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u044d\u043a\u0430\u043f\u044b, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435  \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0431\u0438\u0442\u044c \u0432\u0441\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f  \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c, \u0430 \u044f \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u0441\u044e\u0434\u0430 \u0432\u0430\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/666292\/\"> https:\/\/habr.com\/ru\/post\/666292\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-333275","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/333275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=333275"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/333275\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=333275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=333275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=333275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}