sh Serverpilot app创建

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Serverpilot app创建相关的知识,希望对你有一定的参考价值。

#!/bin/bash

source /home/vagrant/.bash_profile

RED='\033[0;31m'
PURPLE='\033[0;35m'
BLUE='\033[1;34m'
GREEN='\033[1;32m'
NC='\033[0m'

echo -e "${GREEN}Serverpilot app provision${NC}"
echo -e "${RED}Please enter the name of the app:${NC}"
read -r app_name

while [ "$php_version" != "php5.4" ] && [ "$php_version" != "php5.5" ] && [ "$php_version" != "php5.6" ] && [ "$php_version" != "php7.0" ] && [ "$php_version" != "php7.1" ] && [ "$php_version" != "php7.2" ]; do
        echo -e "${RED}Please select which version of PHP (php5.4, php5.5, php5.6, php7.0, or php7.1, or php7.2):${NC}"
        read -r php_version
done

echo -e "${RED}Please enter a domain to use for the site:${NC}"
read -r domain

appId=$(serverpilot find apps serverid=$serverpilot_server_id,name=$app_name id)
if [ ! -z "$appId" ]; then
        echo -e "${RED}The app exist. Try again${NC}"
        exit 1;
fi

result=$( serverpilot apps create "$app_name" "$serverpilot_user_id" "$php_version" '["'"$domain"'"]')

echo $result

appId=$(serverpilot find apps serverid=$serverpilot_server_id,name=$app_name id)
appInfo=$(serverpilot apps $appId)

echo -e "${BLUE}$appInfo"

dbName=$app_name-wp-$(< /dev/urandom tr -dc A-Za-z0-9 | head -c8; echo)
dbUser=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c12; echo)
dbPass=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c16; echo)

serverpilot dbs create $appId $dbName $dbUser $dbPass
echo -e "${BLUE}DB Name: $dbName${NC}"
echo -e "${BLUE}DB User: $dbUser${NC}"
echo -e "${BLUE}DB Pass: $dbPass${NC}"

以上是关于sh Serverpilot app创建的主要内容,如果未能解决你的问题,请参考以下文章

sh 在serverpilot上安装nvm

text Serverpilot禁用服务器范围内的显示php错误

sh 如何使用create-react-app创建一个新的React项目?

sh 简单的bash脚本用于从mac App Sierra创建可启动ISO从Mac App Store安装映像

sh 将使用DiskUtility.app创建的* .cdr图像转换为带有osX终端的* .iso文件

php7.2 sqlsrv 扩展 ubuntu Homestead