Commit c41b3daa authored by Miloš Diviš's avatar Miloš Diviš
Browse files

repo cleanup

parent 62f30bb2
# /bin/bash
# setup
server='195.210.29.9'
user='k-architekt.cz'
remote_dir='/web'
key_path='/home/mario/.ssh/websupport_key'
rsync_exclude=('/www/images/uploads/*')
# index.php excluded and send last because of maintenance mode
common_exclude=('*.ssh' '/temp/*' '/log/*' '/nbproject' '/.git' \
'.gitignore' 'composer.json' '/www/index.php' \
'config.local.neon' 'config.production.neon')
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $current_dir
# set maintenance mode
echo '* setting maintenance mode on remote app'
scp -i $key_path $user@$server:$remote_dir/www/index.php temp/
if [-f temp/index.php)]; then
sed -i "s/\/\/\s*require '.maintenance.php';/require '.maintenance.php';/" temp/index.php
fi
rsync -az \
temp/index.php $user@$server:$remote_dir/www/
rm temp/index.php
# create exclude text file
for i in "${rsync_exclude[@]}"
do
echo $i >> exclude.txt
done
for i in "${common_exclude[@]}"
do
echo $i >> exclude.txt
done
echo "* Starting rsync to $server:$remote_dir"
rsync -az \
--delete \
--filter "P log/*.log" --filter "P log/*.html" \
--include ".htaccess" --exclude-from exclude.txt \
. $user@$server:$remote_dir/
rm exclude.txt
echo ' * uploading production config'
rsync -az \
app/config/config.production.neon
echo '* files uploaded.'
rsync -az \
www/index.php $user@$server:$remote_dir/www/
echo '* maintance mode off. files uploaded'
<?php
// Uncomment this line if you must temporarily take down your site for maintenance.
// require '.maintenance.php';
// Let bootstrap create Dependency Injection container.
$container = require __DIR__ . '/../app/bootstrap.php';
// Run application.
$container->application->run();
while getopts ":d-" opt; do
case ${opt} in
d)
echo '1'
;;
-)
case ${OPTARG} in
"tm"*)
echo '2'
;;
esac
;;
esac
done
while getopts ":a-:" opt; do
case ${opt} in
a) echo "Do something"
;;
-)
case ${OPTARG} in
"word"*) echo "This works"
;;
esac
esac
done
#!/bin/bash
while getopts ":d" opt; do
case $opt in
d)
echo "-d was triggered!"
;;
\?)
echo "Invalid option: -d to delete remote logs" >&2
;;
esac
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment