sh run.sh
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh run.sh相关的知识,希望对你有一定的参考价值。
#!/bin/bash
# 1. deploy deploy app engine
# 2. push push to git origin master
# 3. ibnstall install composer
# 4. setgcp set gcp project-auth
# 5. preview gcp preview
# 6. backupgc backup to google cloud
# 6
function backupgc {
gcloud config set account jamaah.pengaji4n@gmail.com
gcloud config set project rootpixel-1
gsutil -m cp -r ./ gs://rootpixel-1.appspot.com/APPBACKUP/web-daemon
}
# 5
function preview {
/home/rizoa/App/google-cloud-sdk/bin/dev_appserver.py --php_executable_path=/usr/bin/php-cgi app.yaml --port 9001
}
# 4
function setgcp {
export GOOGLE_APPLICATION_CREDENTIALS="/cluster/Code/2018/01/sem_slim/.gcp/gcp.json"
}
# 3
function install {
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv ./composer.phar /usr/bin/composer
}
# 2
function push {
echo "commit:"
read commit
git config credential.helper 'cache --timeout=3000000'
git add --all
git add .
git commit -m "$commit"
git push -u origin master
}
# 1
function deploy {
echo "deploy to gc:"
#read project
gcloud app deploy app.yaml queue.yaml --project $project --quiet
#for i in {1..10}
#do
#gcloud config set account nadheline.sergiose@gmail.com
#gcloud projects create ikamai-antrian-$i
#gcloud config set project ikamai-antrian-$i
#gcloud app create --region asia-northeast1 --project ikamai-antrian-$i
#gcloud app deploy queue.yaml app.yaml --quiet --project ikamai-antrian-$i
#echo $i
gcloud app versions list > version.txt
while IFS='' read -r ln || [[ -n "$ln" ]]; do
if [[ $ln == *"0.00"* ]]; then
IFS=' '
read -ra ADDR <<< "$ln"
echo 'y' | gcloud app versions delete ${ADDR[1]}
fi
done < "version.txt"
rm -rf version.txt
#done
#gcloud app deploy app.yaml cron.yaml --project ikamai-semrush --quiet
}
#############################################
echo ""
echo "create job: $1"
$1
echo ""
#############################################
以上是关于sh run.sh的主要内容,如果未能解决你的问题,请参考以下文章