Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
7ce850e4
Commit
7ce850e4
authored
Aug 14, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve grf
parent
e3141ed2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
grf
gluster/grf
+11
-4
No files found.
gluster/grf
View file @
7ce850e4
#!/bin/sh
LOCKFILE
=
$0
.lock
test
-r
$LOCKFILE
&&
echo
"Already running..."
&&
exit
touch
$LOCKFILE
# Проверяет указанный файл на наличие в возможных местах размещения
fatal
()
{
echo
"FATAL:
$@
"
>
&2
rm
-f
$LOCKFILE
exit
1
}
...
...
@@ -28,6 +33,7 @@ umount_g()
umount
-v
"
$MOUNTDIR
/
$host
/
$path
"
rmdir
"
$MOUNTDIR
/
$host
/
$path
"
done
rm
-f
$LOCKFILE
}
mount_g
()
...
...
@@ -115,6 +121,7 @@ if [ "$1" = "--list" ] ; then
sfile
=
$(
cat
"
$uselist
"
|
grep
^/ |
head
-n1
)
if
[
-z
"
$sfile
"
]
;
then
echo
"Skip empty file
$uselist
"
rm
-f
$LOCKFILE
exit
0
fi
fi
...
...
@@ -182,7 +189,7 @@ fi
get_pgf_name
()
{
local
rfile
=
"
$1
"
echo
".glusterfs/
$(
echo
$rfile
|
cut
-b1-2
)
/
$(
echo
$rfile
|
cut
-b3-4
)
/
$rfile
"
echo
".glusterfs/
$(
echo
"
$rfile
"
|
cut
-b1-2
)
/
$(
echo
"
$rfile
"
|
cut
-b3-4
)
/
$rfile
"
}
tr_gfid_to_rpath
()
...
...
@@ -200,8 +207,8 @@ tr_gfid_to_rpath()
# hack: translate to a path on volume
file
=
"
$(
echo
"
$sfile
"
|
sed
-e
"s|
$FTPROOT
/||g"
)
"
rfile
=
$(
echo
$file
|
sed
-e
"s|<gfid:||g"
|
sed
-e
"s|[<>]||g"
)
rfile
=
$(
get_pgf_name
$rfile
)
rfile
=
$(
echo
"
$file
"
|
sed
-e
"s|<gfid:||g"
|
sed
-e
"s|[<>]||g"
)
rfile
=
$(
get_pgf_name
"
$rfile
"
)
rpath
=
$path
rfile
=
$(
opbrick
"realpath"
"
$rfile
"
)
&&
break
done
...
...
@@ -468,7 +475,7 @@ if [ -n "$uselist" ] ; then
done
else
# TODO: use find?
for
sf
in
$sfile
;
do
for
sf
in
"
$sfile
"
;
do
test_file
"
$sf
"
done
fi
...
...
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