{"id":8,"date":"2018-11-12T01:15:23","date_gmt":"2018-11-12T09:15:23","guid":{"rendered":"http:\/\/www.maddog187.com\/?page_id=8"},"modified":"2018-11-12T01:18:36","modified_gmt":"2018-11-12T09:18:36","slug":"scripts","status":"publish","type":"page","link":"https:\/\/www.maddog187.com\/index.php\/scripts\/","title":{"rendered":"Scripts"},"content":{"rendered":"<p><strong>Clean Vcard:<\/strong><br \/>\nThis awk one liner will search your vcard file (vcf) for blocks that only have telephone numbers and prints them to std out.<\/p>\n<p>awk \u2018\/BEGIN\/ {p=1}; {a[NR]=$0}; \/TEL\/ {f=1}; \/END\/ {p=0; if (f==1) {for (i in a) print a[i]}; delete a;f=0}\u2019 filename.vcf<\/p>\n<p><strong>MySQL Backup:<\/strong><\/p>\n<p>#!\/bin\/sh<br \/>\n#Written by Shawn Rapaz on May 13th, 2013<br \/>\n#This script backups up the complete MySQL database nightly.<\/p>\n<p>curDate=\u201d\/bin\/date +%Y-%m-%d\u201d<br \/>\nDATESTAMP=`\/bin\/date \u201c+%Y-%m-%d\u201d`<br \/>\nBACKUP_DIR=\u201d\/root\/backups\/database_dumps\/\u201d<\/p>\n<p>echo \u201cStarting hourly backup of MySQL database (full)\u2026\u201d<\/p>\n<p>#Does the pgsql dump and compresses it with bzip2<br \/>\nmysqldump \u2013all-databases -u root -pPASSWORD &gt; \/tmp\/alldatabases_nightly.sql<br \/>\n\/bin\/mv \/tmp\/alldatabases_nightly.sql \/tmp\/alldatabases_nightly-$DATESTAMP.sql<br \/>\n\/usr\/bin\/bzip2 \/tmp\/alldatabases_nightly-*.sql<\/p>\n<p>#This moves the hourly backup to the backup directory<br \/>\n\/bin\/mv -f \/tmp\/alldatabases_nightly-*.sql.bz2 $BACKUP_DIR<\/p>\n<p>echo \u201cPostgresql hourly backup completed.\u201d<\/p>\n<p># look for files in archive directory and remove any that are older than 3*24hrs from current date of script starting<br \/>\necho \u201cRemoving files older than 3 days\u201d<br \/>\nfind $BACKUP_DIR -type f -mtime +3 -exec rm {} \\;<br \/>\necho \u201cMySql nightly dump completed at $DATESTAMP\u201d<br \/>\nexit 0<\/p>\n<p><strong>Dirvish Run All:<\/strong><\/p>\n<p>#!\/bin\/bash<\/p>\n<p>#Removes expired backups<br \/>\n\/sbin\/dirvish-expire<\/p>\n<p>#Runs all dirvish backups<br \/>\n\/sbin\/dirvish-runall<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Clean Vcard: This awk one liner will search your vcard file (vcf) for blocks that only have telephone numbers and prints them to std out. awk \u2018\/BEGIN\/ {p=1}; {a[NR]=$0}; \/TEL\/ {f=1}; \/END\/ {p=0; if (f==1) {for (i in a) print a[i]}; delete a;f=0}\u2019 filename.vcf MySQL Backup: #!\/bin\/sh #Written by Shawn Rapaz on May 13th, 2013 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/pages\/8"}],"collection":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":2,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions"}],"predecessor-version":[{"id":17,"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions\/17"}],"wp:attachment":[{"href":"https:\/\/www.maddog187.com\/index.php\/wp-json\/wp\/v2\/media?parent=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}