sh 来自https://segmentfault.com/q/1010000004634747

来自https://segmentfault.com/q/1010000004634747

nginx-enterpoint.sh
#/bin/sh
set -e

if [[ -z "$port" ]]; then
  ls
fi

# run
nginx -g demon off
docker-entrypoint.sh
#!/bin/bash
set -e

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
    if [ -n "$MYSQL_PORT_3306_TCP" ]; then
        if [ -z "$WORDPRESS_DB_HOST" ]; then
            WORDPRESS_DB_HOST='mysql'
        else
            echo >&2 'warning: both WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP found'
            echo >&2 "  Connecting to WORDPRESS_DB_HOST ($WORDPRESS_DB_HOST)"
            echo >&2 '  instead of the linked mysql container'
        fi
    fi
  
    if [ -z "$WORDPRESS_DB_HOST" ]; then
        echo >&2 'error: missing WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
        echo >&2 '  Did you forget to --link some_mysql_container:mysql or set an external db'
        echo >&2 '  with -e WORDPRESS_DB_HOST=hostname:port?'
        exit 1
    fi

    # if we're linked to MySQL and thus have credentials already, let's use them
    : ${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
    if [ "$WORDPRESS_DB_USER" = 'root' ]; then
        : ${WORDPRESS_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
    fi
    : ${WORDPRESS_DB_PASSWORD:=$MYSQL_ENV_MYSQL_PASSWORD}
    : ${WORDPRESS_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-wordpress}}

    if [ -z "$WORDPRESS_DB_PASSWORD" ]; then
        echo >&2 'error: missing required WORDPRESS_DB_PASSWORD environment variable'
        echo >&2 '  Did you forget to -e WORDPRESS_DB_PASSWORD=... ?'
        echo >&2
        echo >&2 '  (Also of interest might be WORDPRESS_DB_USER and WORDPRESS_DB_NAME.)'
        exit 1
    fi

    if ! [ -e index.php -a -e wp-includes/version.php ]; then
        echo >&2 "WordPress not found in $(pwd) - copying now..."
        if [ "$(ls -A)" ]; then
            echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!"
            ( set -x; ls -A; sleep 10 )
        fi
        tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
        echo >&2 "Complete! WordPress has been successfully copied to $(pwd)"
        if [ ! -e .htaccess ]; then
            # NOTE: The "Indexes" option is disabled in the php:apache base image
            cat > .htaccess <<-'EOF'
                # BEGIN WordPress
                <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteRule ^index\.php$ - [L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule . /index.php [L]
                </IfModule>
                # END WordPress
            EOF
            chown www-data:www-data .htaccess
        fi
    fi

    # TODO handle WordPress upgrades magically in the same way, but only if wp-includes/version.php's $wp_version is less than /usr/src/wordpress/wp-includes/version.php's $wp_version

    # version 4.4.1 decided to switch to windows line endings, that breaks our seds and awks
    # https://github.com/docker-library/wordpress/issues/116
    # https://github.com/WordPress/WordPress/commit/1acedc542fba2482bab88ec70d4bea4b997a92e4
    sed -ri 's/\r\n|\r/\n/g' wp-config*

    if [ ! -e wp-config.php ]; then
        awk '/^\/\*.*stop editing.*\*\/$/ && c == 0 { c = 1; system("cat") } { print }' wp-config-sample.php > wp-config.php <<'EOPHP'
// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact
// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
    $_SERVER['HTTPS'] = 'on';
}

EOPHP
        chown www-data:www-data wp-config.php
    fi

    # see http://stackoverflow.com/a/2705678/433558
    sed_escape_lhs() {
        echo "$@" | sed 's/[]\/$*.^|[]/\\&/g'
    }
    sed_escape_rhs() {
        echo "$@" | sed 's/[\/&]/\\&/g'
    }
    php_escape() {
        php -r 'var_export(('$2') $argv[1]);' "$1"
    }
    set_config() {
        key="$1"
        value="$2"
        var_type="${3:-string}"
        start="(['\"])$(sed_escape_lhs "$key")\2\s*,"
        end="\);"
        if [ "${key:0:1}" = '$' ]; then
            start="^(\s*)$(sed_escape_lhs "$key")\s*="
            end=";"
        fi
        sed -ri "s/($start\s*).*($end)$/\1$(sed_escape_rhs "$(php_escape "$value" "$var_type")")\3/" wp-config.php
    }

    set_config 'DB_HOST' "$WORDPRESS_DB_HOST"
    set_config 'DB_USER' "$WORDPRESS_DB_USER"
    set_config 'DB_PASSWORD' "$WORDPRESS_DB_PASSWORD"
    set_config 'DB_NAME' "$WORDPRESS_DB_NAME"

    # allow any of these "Authentication Unique Keys and Salts." to be specified via
    # environment variables with a "WORDPRESS_" prefix (ie, "WORDPRESS_AUTH_KEY")
    UNIQUES=(
        AUTH_KEY
        SECURE_AUTH_KEY
        LOGGED_IN_KEY
        NONCE_KEY
        AUTH_SALT
        SECURE_AUTH_SALT
        LOGGED_IN_SALT
        NONCE_SALT
    )
    for unique in "${UNIQUES[@]}"; do
        eval unique_value=\$WORDPRESS_$unique
        if [ "$unique_value" ]; then
            set_config "$unique" "$unique_value"
        else
            # if not specified, let's generate a random value
            current_set="$(sed -rn "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
            if [ "$current_set" = 'put your unique phrase here' ]; then
                set_config "$unique" "$(head -c1M /dev/urandom | sha1sum | cut -d' ' -f1)"
            fi
        fi
    done

    if [ "$WORDPRESS_TABLE_PREFIX" ]; then
        set_config '$table_prefix' "$WORDPRESS_TABLE_PREFIX"
    fi

    if [ "$WORDPRESS_DEBUG" ]; then
        set_config 'WP_DEBUG' 1 boolean
    fi

    TERM=dumb php -- "$WORDPRESS_DB_HOST" "$WORDPRESS_DB_USER" "$WORDPRESS_DB_PASSWORD" "$WORDPRESS_DB_NAME" <<'EOPHP'
<?php
// database might not exist, so let's try creating it (just to be safe)

$stderr = fopen('php://stderr', 'w');

list($host, $port) = explode(':', $argv[1], 2);

$maxTries = 10;
do {
    $mysql = new mysqli($host, $argv[2], $argv[3], '', (int)$port);
    if ($mysql->connect_error) {
        fwrite($stderr, "\n" . 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n");
        --$maxTries;
        if ($maxTries <= 0) {
            exit(1);
        }
        sleep(3);
    }
} while ($mysql->connect_error);

if (!$mysql->query('CREATE DATABASE IF NOT EXISTS `' . $mysql->real_escape_string($argv[4]) . '`')) {
    fwrite($stderr, "\n" . 'MySQL "CREATE DATABASE" Error: ' . $mysql->error . "\n");
    $mysql->close();
    exit(1);
}

$mysql->close();
EOPHP
fi

exec "$@"

sh 来自https://segmentfault.com/q/1010000004634747

来自https://segmentfault.com/q/1010000004634747

nginx-enterpoint.sh
#/bin/sh
set -e

if [[ -z "$port" ]]; then
  ls
fi

# run
nginx -g demon off
docker-entrypoint.sh
#!/bin/bash
set -e

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
    if [ -n "$MYSQL_PORT_3306_TCP" ]; then
        if [ -z "$WORDPRESS_DB_HOST" ]; then
            WORDPRESS_DB_HOST='mysql'
        else
            echo >&2 'warning: both WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP found'
            echo >&2 "  Connecting to WORDPRESS_DB_HOST ($WORDPRESS_DB_HOST)"
            echo >&2 '  instead of the linked mysql container'
        fi
    fi
  
    if [ -z "$WORDPRESS_DB_HOST" ]; then
        echo >&2 'error: missing WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
        echo >&2 '  Did you forget to --link some_mysql_container:mysql or set an external db'
        echo >&2 '  with -e WORDPRESS_DB_HOST=hostname:port?'
        exit 1
    fi

    # if we're linked to MySQL and thus have credentials already, let's use them
    : ${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
    if [ "$WORDPRESS_DB_USER" = 'root' ]; then
        : ${WORDPRESS_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
    fi
    : ${WORDPRESS_DB_PASSWORD:=$MYSQL_ENV_MYSQL_PASSWORD}
    : ${WORDPRESS_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-wordpress}}

    if [ -z "$WORDPRESS_DB_PASSWORD" ]; then
        echo >&2 'error: missing required WORDPRESS_DB_PASSWORD environment variable'
        echo >&2 '  Did you forget to -e WORDPRESS_DB_PASSWORD=... ?'
        echo >&2
        echo >&2 '  (Also of interest might be WORDPRESS_DB_USER and WORDPRESS_DB_NAME.)'
        exit 1
    fi

    if ! [ -e index.php -a -e wp-includes/version.php ]; then
        echo >&2 "WordPress not found in $(pwd) - copying now..."
        if [ "$(ls -A)" ]; then
            echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!"
            ( set -x; ls -A; sleep 10 )
        fi
        tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
        echo >&2 "Complete! WordPress has been successfully copied to $(pwd)"
        if [ ! -e .htaccess ]; then
            # NOTE: The "Indexes" option is disabled in the php:apache base image
            cat > .htaccess <<-'EOF'
                # BEGIN WordPress
                <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteRule ^index\.php$ - [L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule . /index.php [L]
                </IfModule>
                # END WordPress
            EOF
            chown www-data:www-data .htaccess
        fi
    fi

    # TODO handle WordPress upgrades magically in the same way, but only if wp-includes/version.php's $wp_version is less than /usr/src/wordpress/wp-includes/version.php's $wp_version

    # version 4.4.1 decided to switch to windows line endings, that breaks our seds and awks
    # https://github.com/docker-library/wordpress/issues/116
    # https://github.com/WordPress/WordPress/commit/1acedc542fba2482bab88ec70d4bea4b997a92e4
    sed -ri 's/\r\n|\r/\n/g' wp-config*

    if [ ! -e wp-config.php ]; then
        awk '/^\/\*.*stop editing.*\*\/$/ && c == 0 { c = 1; system("cat") } { print }' wp-config-sample.php > wp-config.php <<'EOPHP'
// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact
// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
    $_SERVER['HTTPS'] = 'on';
}

EOPHP
        chown www-data:www-data wp-config.php
    fi

    # see http://stackoverflow.com/a/2705678/433558
    sed_escape_lhs() {
        echo "$@" | sed 's/[]\/$*.^|[]/\\&/g'
    }
    sed_escape_rhs() {
        echo "$@" | sed 's/[\/&]/\\&/g'
    }
    php_escape() {
        php -r 'var_export(('$2') $argv[1]);' "$1"
    }
    set_config() {
        key="$1"
        value="$2"
        var_type="${3:-string}"
        start="(['\"])$(sed_escape_lhs "$key")\2\s*,"
        end="\);"
        if [ "${key:0:1}" = '$' ]; then
            start="^(\s*)$(sed_escape_lhs "$key")\s*="
            end=";"
        fi
        sed -ri "s/($start\s*).*($end)$/\1$(sed_escape_rhs "$(php_escape "$value" "$var_type")")\3/" wp-config.php
    }

    set_config 'DB_HOST' "$WORDPRESS_DB_HOST"
    set_config 'DB_USER' "$WORDPRESS_DB_USER"
    set_config 'DB_PASSWORD' "$WORDPRESS_DB_PASSWORD"
    set_config 'DB_NAME' "$WORDPRESS_DB_NAME"

    # allow any of these "Authentication Unique Keys and Salts." to be specified via
    # environment variables with a "WORDPRESS_" prefix (ie, "WORDPRESS_AUTH_KEY")
    UNIQUES=(
        AUTH_KEY
        SECURE_AUTH_KEY
        LOGGED_IN_KEY
        NONCE_KEY
        AUTH_SALT
        SECURE_AUTH_SALT
        LOGGED_IN_SALT
        NONCE_SALT
    )
    for unique in "${UNIQUES[@]}"; do
        eval unique_value=\$WORDPRESS_$unique
        if [ "$unique_value" ]; then
            set_config "$unique" "$unique_value"
        else
            # if not specified, let's generate a random value
            current_set="$(sed -rn "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
            if [ "$current_set" = 'put your unique phrase here' ]; then
                set_config "$unique" "$(head -c1M /dev/urandom | sha1sum | cut -d' ' -f1)"
            fi
        fi
    done

    if [ "$WORDPRESS_TABLE_PREFIX" ]; then
        set_config '$table_prefix' "$WORDPRESS_TABLE_PREFIX"
    fi

    if [ "$WORDPRESS_DEBUG" ]; then
        set_config 'WP_DEBUG' 1 boolean
    fi

    TERM=dumb php -- "$WORDPRESS_DB_HOST" "$WORDPRESS_DB_USER" "$WORDPRESS_DB_PASSWORD" "$WORDPRESS_DB_NAME" <<'EOPHP'
<?php
// database might not exist, so let's try creating it (just to be safe)

$stderr = fopen('php://stderr', 'w');

list($host, $port) = explode(':', $argv[1], 2);

$maxTries = 10;
do {
    $mysql = new mysqli($host, $argv[2], $argv[3], '', (int)$port);
    if ($mysql->connect_error) {
        fwrite($stderr, "\n" . 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n");
        --$maxTries;
        if ($maxTries <= 0) {
            exit(1);
        }
        sleep(3);
    }
} while ($mysql->connect_error);

if (!$mysql->query('CREATE DATABASE IF NOT EXISTS `' . $mysql->real_escape_string($argv[4]) . '`')) {
    fwrite($stderr, "\n" . 'MySQL "CREATE DATABASE" Error: ' . $mysql->error . "\n");
    $mysql->close();
    exit(1);
}

$mysql->close();
EOPHP
fi

exec "$@"

sh 将所有现有的vim包添加到gitmodules

将所有现有的vim包添加到gitmodules

migrate-plugin.sh
plugins=$(find . -type d -d 1  | tail -n +3)
for plugin in $plugins; do
    echo plugin: $plugin
    cd $plugin
    repo=$(git remote -v | head -n 1 | cut -f 2 | cut -f 1 -d ' ')
    echo repo: $repo
    cd ..
    git submodule add $repo
done

sh 一个用于supervisord的init.d脚本

一个用于supervisord的init.d脚本

supervisord.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides:          supervisord
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

# Author: Dan MacKinlay <danielm@phm.gov.au>
# Based on instructions by Bertrand Mathieu
# http://zebert.blogspot.com/2009/05/installing-django-solr-varnish-and.html

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Description of the service"
NAME=supervisord
DAEMON=/usr/local/bin/supervisord
DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
	# Return
	#   0 if daemon has been started
	#   1 if daemon was already running
	#   2 if daemon could not be started
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
		|| return 1
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
		$DAEMON_ARGS \
		|| return 2
	# Add code here, if necessary, that waits for the process to be ready
	# to handle requests from services started subsequently which depend
	# on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
	# Return
	#   0 if daemon has been stopped
	#   1 if daemon was already stopped
	#   2 if daemon could not be stopped
	#   other if a failure occurred
	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
	RETVAL="$?"
	[ "$RETVAL" = 2 ] && return 2
	# Wait for children to finish too if this is a daemon that forks
	# and if the daemon is only ever run from this initscript.
	# If the above conditions are not satisfied then add some other code
	# that waits for the process to drop all resources that could be
	# needed by services started subsequently.  A last resort is to
	# sleep for some time.
	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
	[ "$?" = 2 ] && return 2
	# Many daemons don't delete their pidfiles when they exit.
	rm -f $PIDFILE
	return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
	#
	# If the daemon can reload its configuration without
	# restarting (for example, when it is sent a SIGHUP),
	# then implement that here.
	#
	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
	return 0
}

case "$1" in
  start)
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
	do_start
	case "$?" in
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
	esac
	;;
  stop)
	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
	do_stop
	case "$?" in
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
	esac
	;;
  #reload|force-reload)
	#
	# If do_reload() is not implemented then leave this commented out
	# and leave 'force-reload' as an alias for 'restart'.
	#
	#log_daemon_msg "Reloading $DESC" "$NAME"
	#do_reload
	#log_end_msg $?
	#;;
  restart|force-reload)
	#
	# If the "reload" option is implemented then remove the
	# 'force-reload' alias
	#
	log_daemon_msg "Restarting $DESC" "$NAME"
	do_stop
	case "$?" in
	  0|1)
		do_start
		case "$?" in
			0) log_end_msg 0 ;;
			1) log_end_msg 1 ;; # Old process is still running
			*) log_end_msg 1 ;; # Failed to start
		esac
		;;
	  *)
	  	# Failed to stop
		log_end_msg 1
		;;
	esac
	;;
  *)
	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 3
	;;
esac

:

sh 通过vnc远程访问linux

通过vnc远程访问linux

remote_access_via_vnc.sh
http://www.junauza.com/2010/04/remote-control-your-linux-desktop-using.html

# if auth error 18 happends
# need to allow plain auth for clients
gsettings set org.gnome.Vino require-encryption false

sh 此脚本清除Docker.qcow2文件,该文件使用Docker For Mac占用大量磁盘空间。您可以指定一些您想要的Docker镜像

此脚本清除Docker.qcow2文件,该文件使用Docker For Mac占用大量磁盘空间。您可以指定一些您想要保留的Docker镜像。

clean-docker-for-mac.sh
#!/bin/bash

# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of 
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

IMAGES=$@

echo "This will remove all your current containers and images except for:"
echo ${IMAGES}
read -p "Are you sure? [yes/NO] " -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
    exit 1
fi


TMP_DIR=$(mktemp -d)

pushd $TMP_DIR >/dev/null

open -a Docker
echo "=> Saving the specified images"
for image in ${IMAGES}; do
	echo "==> Saving ${image}"
	tar=$(echo -n ${image} | base64)
	docker save -o ${tar}.tar ${image}
	echo "==> Done."
done

echo "=> Cleaning up"
echo -n "==> Quiting Docker"
osascript -e 'quit app "Docker"'
while docker info >/dev/null 2>&1; do
	echo -n "."
	sleep 1
done;
echo ""

echo "==> Removing Docker.qcow2 file"
rm ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

echo "==> Launching Docker"
open -a Docker
echo -n "==> Waiting for Docker to start"
until docker info >/dev/null 2>&1; do
	echo -n "."
	sleep 1
done;
echo ""

echo "=> Done."

echo "=> Loading saved images"
for image in ${IMAGES}; do
	echo "==> Loading ${image}"
	tar=$(echo -n ${image} | base64)
	docker load -q -i ${tar}.tar || exit 1
	echo "==> Done."
done

popd >/dev/null
rm -r ${TMP_DIR}

sh HTPC初学者的Atomic Toolkit安装程序

HTPC初学者的Atomic Toolkit安装程序

atomicinstall.sh
#/bin/bash
#The one step installer for the AtoMiC-ToolKit
#Written by KnightCinema.com
touch /var/log/atomic-install.log
echo "Updating APT ..."
apt-get -y update > /var/log/atomic-install.log
echo "Installing Prerequsits"
apt-get -y install git-core nano python-software-properties dialog > /var/log/atomic-install.log
dialog --title "The AtoMiC Tool Kit installer"  --yesno "This will install the AtomMiC toolkit as well as some prerequsits. Please be aware this software is provided with no warranties. Proceed at your own risk. Would you like to continue?" 8 100
# Cloaning into the OPT folder for organization.
echo "Downloading the AtoMiC-ToolKit"
git clone https://github.com/htpcBeginner/AtoMiC-ToolKit.git /opt/AtoMiC-ToolKit > /var/log/atomic-install.log
#Creat a sym link to the user bin so the toolkit can be accessed by typing atk.
echo "Installing AtoMiC-ToolKit"
ln -s -T /opt/AtoMiC-ToolKit/setup.sh /usr/local/bin/atk > /var/log/atomic-install.log
echo "Install Finished. You can use the AtoMiC-ToolKit by typing atk anytime. Starting the AtoMiC-ToolKit now."
sleep 5
rm /tmp/atomicinstaller.sh
atk

sh 设置mac更像是linux

设置mac更像是linux

setup.sh
# https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/

brew install coreutils
brew install binutils
brew install diffutils
brew install ed --with-default-names
brew install findutils --with-default-names
brew install gawk
brew install gnu-indent --with-default-names
brew install gnu-sed --with-default-names
brew install gnu-tar --with-default-names
brew install gnu-which --with-default-names
brew install gnutls
brew install grep --with-default-names
brew install gzip
brew install screen
brew install watch
brew install wdiff --with-gettext
brew install wget

sh 将证书上载到AWS IAM以在Cloudfront中使用

将证书上载到AWS IAM以在Cloudfront中使用

upload_certificate.sh
aws iam upload-server-certificate --server-certificate-name star_amon_cx --certificate-body file://star_amon_cx_body.cer --private-key file://star_amon_cx.key --certificate-chain file://star_amon_cx_chain.cer --profile personal --path /cloudfront/

sh Sheel script untuk jenkins。处理dengan nama yang dimasukan akan di kill dan dijalankan ulang dalam virtual env

Sheel script untuk jenkins。处理dengan nama yang dimasukan akan di kill dan dijalankan ulang dalam virtual env

Jenkins - force restart python.sh
#!/bin/bash
# Kill previous running process
pkill -f "wsgi.py managix_api"

# Activate virtual environment
. env/bin/activate

# Run wsgi.py with nohup and give managix_api arg
BUILD_ID=Jenkins nohup python wsgi.py managix_api &