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
e185b59a
Commit
e185b59a
authored
Mar 13, 2021
by
sml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
3e16f307
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
CmdExecToolApplication.java
...n/java/com/jz/dmp/cmdexectool/CmdExecToolApplication.java
+0
-2
hdfs_upload.ftl
src/main/resources/templates/hdfs_upload.ftl
+14
-9
No files found.
src/main/java/com/jz/dmp/cmdexectool/CmdExecToolApplication.java
View file @
e185b59a
...
...
@@ -3,7 +3,6 @@ package com.jz.dmp.cmdexectool;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.Banner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.WebApplicationType
;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
...
...
@@ -12,7 +11,6 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean
;
import
com.jz.dmp.cmdexectool.common.utils.ApplicationContextUtil
;
import
com.jz.dmp.cmdexectool.scheduler.service.process.ProcessService
;
...
...
src/main/resources/templates/hdfs_upload.ftl
View file @
e185b59a
...
...
@@ -6,19 +6,24 @@ file_suffix="${file_suffix!}"
# 要上传到hdfs的目录
des_dir
=
${
des_dir
!
}
cd
$src_dir
if
[
$file_suffix
=
""
]
;
then
echo
"没有后缀"
filename
=
"*"
filename
=
`
ls
-l
|
grep
^- |
awk
'{print $9}'
`
else
filename
=
"*.
${
file_suffix
}
"
filename
=
`
ls
-l
|
grep
^- |
awk
'{print $9}'
|
grep
.
${
file_suffix
}
`
fi
# 判断 hdfs 文件夹是否存在
su hdfs
-c
"hdfs dfs -test -e
${
des_dir
}
"
# 获取当前系统时间
time
=
`
date
+%Y%m%d%H%M%S
`
des_dir
=
${
r
'"${des_dir}/${time}"'
}
if
[
$?
-ne
0
]
;
then
echo
"====================hdfs 文件夹不存在, 自动创建======================"
su hdfs
-c
"hdfs dfs -mkdir -p
${
des_dir
}
"
fi
echo
"====================hdfs 文件夹不存在, 自动创建======================"
su hdfs
-c
"hdfs dfs -mkdir -p
${
des_dir
}
"
su hdfs
-c
"hdfs dfs -put
${
src_dir
}
/
${
filename
}
${
des_dir
}
/"
\ No newline at end of file
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