Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Beam Positoning Monitor - Software
Commits
9d678782
Commit
9d678782
authored
May 21, 2015
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scripts/deploy.sh: simplifify to allow username/ip on command-line
parent
9c0747ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
deploy.sh
scripts/deploy.sh
+30
-30
No files found.
scripts/deploy.sh
View file @
9d678782
#!/bin/bash
TOP_DIR
=
..
REMOTE_HOME
=
"/home"
REMOTE_USERNAME
=
"lnls-bpm"
REMOTE_IP
=
10.0.18.52
LOCAL_IP
=
10.0.18.35
REMOTE_DIR
=
"bpm-sw-deploy"
BOARD_TYPE
=
"afcv3"
REMOTE_DEPLOY_DIR
=
"
${
REMOTE_HOME
}
/
${
REMOTE_USERNAME
}
/
${
REMOTE_DIR
}
"
REMOTE_LOG_DIR
=
"/media/remote_logs"
CREATE_DIR_CMD
=
"mkdir -p
${
REMOTE_DEPLOY_DIR
}
"
MOUNT_REMOTE_LOG_CMD
=
"sshfs
${
whoami
}
@
${
LOCAL_IP
}
:~/remote_logs
${
REMOTE_LOG_DIR
}
"
COMPILE_CMD
=
"./compile.sh"
#RUN_CMD="./init.sh tcp ${REMOTE_IP} ${REMOTE_LOG_DIR}"
#RUN_CMD="systemctl start bpm-sw.service"
REMOTE_USERNAME
=
$1
REMOTE_IP
=
$2
REMOTE_DIR
=
$3
function
usage
{
echo
"Usage:
$0
<remote_username> <remote_ip> <remote_dir>"
}
if
[
-z
"
$REMOTE_USERNAME
"
]
;
then
echo
"
\"
REMOTE_USERNAME
\"
variable unset."
usage
exit
1
fi
if
[
-z
"
$REMOTE_IP
"
]
;
then
echo
"
\"
REMOTE_IP
\"
variable unset."
usage
exit
1
fi
if
[
-z
"
$REMOTE_DIR
"
]
;
then
echo
"
\"
REMOTE_DIR
\"
variable unset."
usage
exit
1
fi
CREATE_DIR_CMD
=
"mkdir -p
${
REMOTE_DIR
}
"
# Change working directory
cd
${
TOP_DIR
}
...
...
@@ -24,23 +37,10 @@ cd ${TOP_DIR}
echo
"Creating remote directories on
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
"
ssh
-l
${
REMOTE_USERNAME
}
${
REMOTE_IP
}
"
${
CREATE_DIR_CMD
}
"
# Mount remote log directory
#echo "Mounting remote LOG directory to ${REMOTE_LOG_DIR}"
#ssh -l ${REMOTE_USERNAME} ${REMOTE_IP} "${MOUNT_REMOTE_LOG_CMD}"
# Find all source files
SRC_FILES
=
$(
find
.
-type
f
!
-iname
"*.[o|a]"
!
-iname
"*orig"
\
!
-iname
"*.swp"
!
-iname
"*.swap"
!
-iname
"*.txt"
!
-iname
"*.pyc"
\
!
-path
"./majordomo*"
!
-path
"./.git*"
)
SYM_FILES
=
$(
find
.
-type
l
!
-iname
"*.[o|a]"
!
-iname
"*orig"
\
!
-iname
"*.swp"
!
-iname
"*.swap"
!
-iname
"*.txt"
!
-iname
"*.pyc"
\
!
-path
"./majordomo*"
!
-path
"./.git*"
)
echo
"Copying files to
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
:
${
REMOTE_DEPLOY_DIR
}
"
rsync
-Rpr
${
SRC_FILES
}
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
:
${
REMOTE_DEPLOY_DIR
}
rsync
-Rpr
${
SYM_FILES
}
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
:
${
REMOTE_DEPLOY_DIR
}
echo
"Compiling source files with
\"
${
COMPILE_CMD
}
\"
"
ssh
-l
${
REMOTE_USERNAME
}
${
REMOTE_IP
}
"cd
${
REMOTE_DEPLOY_DIR
}
&&
\
${
COMPILE_CMD
}
"
!
-path
"./.git*"
)
echo
"Copying files to
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
:
${
REMOTE_DIR
}
"
rsync
-Rpr
${
SRC_FILES
}
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
:
${
REMOTE_DIR
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment