Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-cmdexectool
Project
Project
Details
Activity
Releases
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
jz-dmp-cmdexectool
Commits
d6170da2
Commit
d6170da2
authored
Mar 13, 2021
by
sml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
e185b59a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
hdfs_upload.ftl
src/main/resources/templates/hdfs_upload.ftl
+3
-4
hdfs_upload2.ftl
src/main/resources/templates/hdfs_upload2.ftl
+29
-0
No files found.
src/main/resources/templates/hdfs_upload.ftl
View file @
d6170da2
...
@@ -5,9 +5,8 @@ src_dir=${src_dir!}
...
@@ -5,9 +5,8 @@ src_dir=${src_dir!}
file_suffix
=
"
${
file_suffix
!
}
"
file_suffix
=
"
${
file_suffix
!
}
"
# 要上传到hdfs的目录
# 要上传到hdfs的目录
des_dir
=
${
des_dir
!
}
des_dir
=
${
des_dir
!
}
# 获取 src_dir 下所有文件为 file_suffix 的文件
cd
$src_dir
cd
${
src_dir
}
if
[
$file_suffix
=
""
]
;
then
if
[
$file_suffix
=
""
]
;
then
echo
"没有后缀"
echo
"没有后缀"
filename
=
`
ls
-l
|
grep
^- |
awk
'{print $9}'
`
filename
=
`
ls
-l
|
grep
^- |
awk
'{print $9}'
`
...
...
src/main/resources/templates/hdfs_upload2.ftl
0 → 100644
View file @
d6170da2
#!/bin/bash
# 要上传到hdfs的来源目录
src_dir
=
${
src_dir
!
}
# 要上传的文件类型
file_suffix
=
"
${
file_suffix
!
}
"
# 要上传到hdfs的目录
des_dir
=
${
des_dir
!
}
cd
$src_dir
if
[
$file_suffix
=
""
]
;
then
echo
"没有后缀"
filename
=
`
ls
-l
|
grep
^- |
awk
'{print $9}'
`
else
filename
=
`
ls
-l
|
grep
^- |
awk
'{print $9}'
|
grep
.
${
file_suffix
}
`
fi
# 获取当前系统时间
time
=
`
date
+%Y%m%d%H%M%S
`
des_dir
=
${
r
'"${des_dir}/${time}"'
}
echo
"====================hdfs 文件夹不存在, 自动创建======================"
su hdfs
-c
"hdfs dfs -mkdir -p
${
des_dir
}
"
for
file
in
${
r
'${filename}'
}
do
echo
"正在上传hdfs的文件是:
${
r
'${src_dir}/${file}'
}
"
${
r
'su hdfs -c "hdfs dfs -put ${src_dir}/${file} ${des_dir}/"'
}
done
\ No newline at end of file
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