Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dm-docs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hammonds
dm-docs
Commits
04d808b7
Commit
04d808b7
authored
8 years ago
by
sveseli
Browse files
Options
Downloads
Plain Diff
working fix for directory name
parents
17dafaa1
6f760af5
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/RELEASE_NOTES.txt
+2
-0
2 additions, 0 deletions
doc/RELEASE_NOTES.txt
sbin/dm_backup.sh
+117
-0
117 additions, 0 deletions
sbin/dm_backup.sh
src/python/dm/common/processing/plugins/fileTransferPlugin.py
+4
-5
4 additions, 5 deletions
...python/dm/common/processing/plugins/fileTransferPlugin.py
with
123 additions
and
5 deletions
doc/RELEASE_NOTES.txt
+
2
−
0
View file @
04d808b7
...
@@ -2,6 +2,8 @@ Release 0.10 (03/11/2016)
...
@@ -2,6 +2,8 @@ Release 0.10 (03/11/2016)
=============================
=============================
- Added dm-list-daqs and dm-list-uploads commands
- Added dm-list-daqs and dm-list-uploads commands
- Resolved issue with newly created directories treated as files for
real-time data acquisitions
Release 0.9 (02/25/2016)
Release 0.9 (02/25/2016)
=============================
=============================
...
...
This diff is collapsed.
Click to expand it.
sbin/dm_backup.sh
0 → 100755
+
117
−
0
View file @
04d808b7
#!/bin/sh
#
# Script used for backing up DM database + web app
# Deployment configuration can be set in etc/$DM_DM_DB_NAME.deploy.conf file
#
# Usage:
#
# $0 [DM_DB_NAME [DM_BACKUP_DIR]]
#
DM_DB_NAME
=
dm
DM_DB_HOST
=
127.0.0.1
DM_DB_PORT
=
11136
DM_DB_ADMIN_USER
=
postgres
DM_DB_ADMIN_PASSWORD
=
CURRENT_DIR
=
`
pwd
`
MY_DIR
=
`
dirname
$0
`
&&
cd
$MY_DIR
&&
MY_DIR
=
`
pwd
`
cd
$CURRENT_DIR
if
[
-z
"
${
DM_ROOT_DIR
}
"
]
;
then
DM_ROOT_DIR
=
$MY_DIR
/..
fi
DM_SQL_DIR
=
$DM_ROOT_DIR
/db/sql/dm
DM_ENV_FILE
=
${
DM_ROOT_DIR
}
/setup.sh
if
[
!
-f
${
DM_ENV_FILE
}
]
;
then
echo
"Environment file
${
DM_ENV_FILE
}
does not exist."
exit
2
fi
.
${
DM_ENV_FILE
}
>
/dev/null
# Use first argument as db name, if provided
if
[
!
-z
"
$1
"
]
;
then
DM_DB_NAME
=
$1
fi
echo
"Backing up
$DM_DB_NAME
"
# Look for deployment file in etc directory, and use it to override
# default entries
deployConfigFile
=
$DM_ROOT_DIR
/etc/
${
DM_DB_NAME
}
.deploy.conf
if
[
-f
$deployConfigFile
]
;
then
echo
"Using deployment config file:
$deployConfigFile
"
.
$deployConfigFile
else
echo
"Deployment config file
$deployConfigFile
not found, using defaults"
fi
# Determine run directory
if
[
-z
"
${
DM_INSTALL_DIR
}
"
]
;
then
DM_INSTALL_DIR
=
$DM_ROOT_DIR
/..
fi
# Second argument overrides directory with db population scripts
#timestamp=`date +%Y%m%d.%H%M%S`
timestamp
=
`
date
+%Y%m%d
`
DM_BACKUP_DIR
=
$2
if
[
-z
$DM_BACKUP_DIR
]
;
then
DM_BACKUP_DIR
=
$DM_INSTALL_DIR
/backup/
$DM_DB_NAME
/
$timestamp
fi
backupFile
=
${
DM_DB_NAME
}
.backup.
$timestamp
.sql
fullBackupFilePath
=
$DM_BACKUP_DIR
/
$backupFile
# Read password
sttyOrig
=
`
stty
-g
`
stty
-echo
read
-p
"Enter
$DM_DB_NAME
user password: "
DM_DB_USER_PASSWORD
stty
$sttyOrig
echo
DM_DB_USER_PASSWORD_FILE
=
/tmp/
${
DM_DB_NAME
}
.
${
DM_DB_USER
}
.passwd
echo
$DM_DB_HOST
:
$DM_DB_PORT
:
$DM_DB_NAME
:
$DM_DB_USER
:
$DM_DB_USER_PASSWORD
>
$DM_DB_USER_PASSWORD_FILE
&&
chmod
600
$DM_DB_USER_PASSWORD_FILE
||
exit
1
pgDumpCmd
=
"PGPASSFILE=
$DM_DB_USER_PASSWORD_FILE
pg_dump -C -c -w --column-inserts -p
$DM_DB_PORT
-h
$DM_DB_HOST
-U
$DM_DB_USER
-d
$DM_DB_NAME
"
cleanup
()
{
rm
-f
$DM_DB_USER_PASSWORD
}
execute
()
{
eval
"
$@
"
}
echo
echo
"Using DB backup directory:
$DM_BACKUP_DIR
"
mkdir
-p
$DM_BACKUP_DIR
eval
$pgDumpCmd
>
$fullBackupFilePath
||
(
cleanup
&&
exit
1
)
nTables
=
`
grep
-n
"Data for Name"
$fullBackupFilePath
|
grep
TABLE |
wc
-l
`
echo
"Processing
$nTables
tables"
tableCnt
=
0
processingFile
=
$DM_BACKUP_DIR
/process.txt
while
[
$tableCnt
-lt
$nTables
]
;
do
tableCnt
=
`
expr
$tableCnt
+ 1
`
headLine
=
$tableCnt
tailLine
=
2
echo
"Working on table #:
$tableCnt
"
grep
-n
"TABLE DATA"
$fullBackupFilePath
|
head
-
$headLine
|
tail
-
$tailLine
>
$processingFile
dbTable
=
`
cat
$processingFile
|
head
-1
|
awk
'{print $5}'
|
sed
's?;??g'
`
echo
"Creating sql script for
$dbTable
"
targetFile
=
$DM_BACKUP_DIR
/populate_
$dbTable
.sql
pgDumpCmd
=
"PGPASSFILE=
$DM_DB_USER_PASSWORD_FILE
pg_dump -C -a -t
$dbTable
-w --column-inserts -p
$DM_DB_PORT
-h
$DM_DB_HOST
-U
$DM_DB_USER
-d
$DM_DB_NAME
"
eval
$pgDumpCmd
>
$targetFile
||
(
cleanup
&&
exit
1
)
done
rm
-f
$processingFile
# Backup web app
echo
"Backing up
$DM_DB_NAME
web app"
rsync
-arlvP
$DM_SUPPORT_DIR
/glassfish/linux-x86_64/glassfish/domains/domain1/autodeploy/
$DM_DB_NAME
.war
$DM_BACKUP_DIR
cleanup
echo
"Backup of
$DM_DB_NAME
is done."
This diff is collapsed.
Click to expand it.
src/python/dm/common/processing/plugins/fileTransferPlugin.py
+
4
−
5
View file @
04d808b7
...
@@ -34,15 +34,14 @@ class FileTransferPlugin(FileProcessor):
...
@@ -34,15 +34,14 @@ class FileTransferPlugin(FileProcessor):
self
.
start
(
src
=
srcUrl
,
dest
=
destUrl
,
templateInfo
=
fileInfo
)
self
.
start
(
src
=
srcUrl
,
dest
=
destUrl
,
templateInfo
=
fileInfo
)
def
getSrcUrl
(
self
,
filePath
,
dataDirectory
):
def
getSrcUrl
(
self
,
filePath
,
dataDirectory
):
return
filePath
srcUrl
=
'
%s/./%s
'
%
(
dataDirectory
,
os
.
path
.
relpath
(
filePath
,
dataDirectory
))
return
srcUrl
def
getDestUrl
(
self
,
filePath
,
dataDirectory
,
storageHost
,
storageDirectory
):
def
getDestUrl
(
self
,
filePath
,
dataDirectory
,
storageHost
,
storageDirectory
):
# Use relative path with respect to data directory as a source
srcUrl
=
os
.
path
.
relpath
(
filePath
,
dataDirectory
)
if
self
.
dest
:
if
self
.
dest
:
destUrl
=
'
%s/
%s
'
%
(
self
.
dest
,
srcUrl
)
destUrl
=
'
%s/
'
%
(
self
.
dest
)
else
:
else
:
destUrl
=
'
%s:%s/
%s
'
%
(
storageHost
,
storageDirectory
,
srcUrl
)
destUrl
=
'
%s:%s/
'
%
(
storageHost
,
storageDirectory
)
return
destUrl
return
destUrl
def
getSrcDirUrl
(
self
,
dataDirectory
):
def
getSrcDirUrl
(
self
,
dataDirectory
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment