maple/autosync.sh
2022-08-29 03:07:28 -05:00

22 lines
1.9 KiB
Bash

########################################################################################################################## SOF
# 1) if this is ran without a parameter services are stopped, local files are updated via github and then services restarted
# 2) if this is ran with a parameter /path/to/file.etc the file is autocopied across the core and dupes, all pushed to github
# 2) and then remote instances are updated locally from what we pushed from devops.. this speeds up development/testing time.
##############################################################################################################################
COREKEY=maplenet; COREUSER=dr1p; COREHOST=saipro; COREBASE=~/maple;
DUPEKEY=maplenet; DUPEUSER=dr1p; DUPEHOST=saiosx; DUPEBASE=~/maple;
##############################################################################################################################
##############################################################################################################################
FILENAME=$(basename `echo "$1"`)
find . -iname $FILENAME|grep -v $1|xargs -I{} cp $1 {}
find . -iname $FILENAME|xargs -I{} git add {}
git commit -m "script: autosync.sh"
git push
##############################################################################################################################
##############################################################################################################################
ssh -i ~/.ssh/$COREKEY $COREUSER@$COREHOST "cd $COREBASE/hydra_core__standalone; bash stop.sh; git pull; bash start.sh & disown"
ssh -i ~/.ssh/$DUPEKEY $DUPEUSER@$DUPEHOST "cd $DUPEBASE/hydra_dupe__services; bash stop.sh; git pull; bash start.sh & disown"
##############################################################################################################################
########################################################################################################################## EOF