All the things I forgot to commit
This commit is contained in:
parent
067598a965
commit
f0aead5584
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Best practice options
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
|
||||
|
||||
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
|
||||
echo 'Usage:
|
||||
c66 ssh Select and SSH to a server
|
||||
c66 log file role Select a stack and tail the file “file” on all its servers
|
||||
'
|
||||
exit
|
||||
fi
|
||||
|
||||
pushd ~
|
||||
|
||||
############################################################
|
||||
## Main commands
|
||||
############################################################
|
||||
|
||||
cx_ssh() {
|
||||
set_stack
|
||||
set_server
|
||||
cx ssh --stack $APPLICATION --environment $ENVIRONMENT $SERVER
|
||||
}
|
||||
|
||||
cx_log() {
|
||||
set_stack
|
||||
SERVERS=$(cx servers list --stack $APPLICATION --environment $ENVIRONMENT | grep "\[.*$ROLE.*\]" | cut -d ' ' -f1)
|
||||
for SERVER in ${SERVERS// /} ; do
|
||||
cx tail --stack $APPLICATION --environment $ENVIRONMENT $SERVER $LOG_FILE &
|
||||
done
|
||||
}
|
||||
|
||||
############################################################
|
||||
## Helper functions
|
||||
############################################################
|
||||
|
||||
set_stack() {
|
||||
STACK=$(cx stacks list | fzf)
|
||||
APPLICATION=$(echo $STACK | cut -d ' ' -f1)
|
||||
ENVIRONMENT=$(echo $STACK | cut -d ' ' -f2)
|
||||
}
|
||||
|
||||
set_server() {
|
||||
SERVER=$(cx servers list --stack $APPLICATION --environment $ENVIRONMENT | fzf | cut -d ' ' -f1)
|
||||
}
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
echo "No arguments given. Use -h for help."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $1 = "ssh" ]] ; then
|
||||
cx_ssh
|
||||
elif [[ $1 = "log" ]] ; then
|
||||
LOG_FILE=$2
|
||||
ROLE=$3
|
||||
cx_log
|
||||
fi
|
||||
|
||||
popd
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'active_support/core_ext/string/inflections'
|
||||
|
||||
file = "/home/tsv/foxsoft/directors-uk/clapboard/app/models/concerns/progress_countries.rb"
|
||||
|
||||
File.open(file, "r+") do |f|
|
||||
while(line = f.gets) != nil
|
||||
m = line.match /\s\[\"(?<country>[\w\s\:\&\'\-\;\(\)]*)\".*\]/
|
||||
puts line.gsub(m[:country], m[:country].titlecase) if m
|
||||
end
|
||||
end
|
|
@ -61,6 +61,7 @@ replace_links() {
|
|||
}
|
||||
|
||||
setup_files() {
|
||||
cp -r ~/code/site/assets/ ~/public_html/
|
||||
cp ~/code/site/style.css ~/public_html
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Best practice options
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
|
||||
|
||||
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
|
||||
echo 'Usage:
|
||||
'
|
||||
exit
|
||||
fi
|
||||
|
||||
pushd ~
|
||||
|
||||
[ -d ~/sshfs/obs ] || mkdir -p ~/sshfs/obs
|
||||
sshfs obs:/srv/salt ~/sshfs/obs
|
||||
pushd ~/sshfs/obs
|
||||
nvim
|
||||
umount ~/sshfs/obs
|
||||
popd
|
||||
popd
|
Loading…
Reference in New Issue