- pgx_list_dbs: Lists the names of databases in an .sql file dumped using pg_dumpall.
- pgx_extract_db: Extracts a single database from a sql file dumped with pg_dumpall and outputs its content to stdout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # The script will fail at the first error encountered | |
| set -e | |
| PASS=`pwgen -s 40 1` | |
| mysql -uroot <<MYSQL_SCRIPT | |
| CREATE DATABASE $1; | |
| CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS'; | |
| GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| clear | |
| echo "============================================" | |
| echo "Instalador de Wordpress" | |
| echo "============================================" | |
| echo "Host do Banco de dados: " | |
| read -e dbhost | |
| echo "Nome do Banco de dados: " | |
| read -e dbname | |
| echo "Usúario do Banco de dados: " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Destiny folder where backups are stored | |
| DEST=/tmp/bacula/server01 | |
| CURRDATE=$(date +"%F") | |
| # Hostname where MySQL is running | |
| HOSTNAME="srv-mysql" | |
| # User name to make backup | |
| USER="root" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Use this script to perform backups of one or more MySQL databases. | |
| # | |
| # Databases that you wish to be backed up by this script. You can have any number of databases specified; encapsilate each database name in single quotes and separate each database name by a space. | |
| # | |
| # Example: | |
| # databases=( '__DATABASE_1__' '__DATABASE_2__' ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| ## | |
| # Quick and dirty website monitor | |
| # | |
| # add to cron: | |
| # */5 * * * * $HOME/webmon.sh >> $HOME/logs/user/cron.log 2>&1 | |
| ## | |
| if curl -s http://website.org | grep -q "Page title"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # script to check website status (online/ofline) | |
| while read site | |
| do | |
| if wget -p "$site" -O /dev/null &>/dev/null; then | |
| echo "$site is up" | |
| else | |
| # action to do if website offline | |
| echo "[$(date +%d-%m-%Y:%H:%M:%S)] $site is not reachable." | ./slack-post.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install libmoose-perl libtemplate-perl libmoosex-types-path-class-perl libdatetime-perl libdatetime-format-w3cdtf-perl libtemplate-plugin-html-strip-perl libdata-guid-perl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ## backup each mysql db into a different file, rather than one big file | |
| ## as with --all-databases. This will make restores easier. | |
| ## To backup a single database simply add the db name as a parameter (or multiple dbs) | |
| ## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is | |
| ## Create the user and directories | |
| # mkdir -p /var/backups/mysql/databases | |
| # useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup | |
| ## Remember to make the script executable, and unreadable by others |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Oracle XE requires a swap file of at least twice the size of physical memory | |
| # see https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-6 | |
| # check current swap file | |
| swapon -s | |
| # check available space | |
| df | |
| # setup 2GB swap file | |
| dd if=/dev/zero of=/swapfile bs=1024 count=2048k |
OlderNewer