Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
92
Merge Requests
92
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
c54b3b64
Commit
c54b3b64
authored
Jul 22, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5testnode: add x11_video_catcher.sh
parent
581cd767
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
software/erp5testnode/software.cfg
software/erp5testnode/software.cfg
+14
-0
software/erp5testnode/x11_video_catcher.sh
software/erp5testnode/x11_video_catcher.sh
+62
-0
No files found.
software/erp5testnode/software.cfg
View file @
c54b3b64
...
...
@@ -11,6 +11,7 @@ extends =
../../component/shellinabox/buildout.cfg
../../component/pwgen/buildout.cfg
../../component/apache/buildout.cfg
../../component/ffmpeg/buildout.cfg
../../stack/monitor/buildout.cfg
parts =
...
...
@@ -20,6 +21,8 @@ parts =
eggs
zip
git
ffmpeg
x11_video_catcher.sh
apache
[eggs]
...
...
@@ -60,6 +63,17 @@ url = ${:_profile_base_location_}/instance-default.cfg
output = ${buildout:directory}/template-default.cfg
mode = 0644
[copy-to-instance]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_buildout_section_name_}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = ${:_buildout_section_name_}
[x11_video_catcher.sh]
<= copy-to-instance
md5sum = c6110c6dd08b6cc65c3ed969f2c80af0
mode = 0755
[versions]
erp5.util = 0.4.58
slapos.recipe.template = 4.3
...
...
software/erp5testnode/x11_video_catcher.sh
0 → 100755
View file @
c54b3b64
#!/bin/sh
# scan running process and run ffmpeg
# for write video of xvfb session
ffmpeg_bin
=
$(
find ~
-path
*
/bin/ffmpeg
-type
f
)
echo
${
ffmpeg_bin
}
while
true
;
do
ps
-u
$(
id
-u
)
-o
pid
=
|
\
while
read
pid
;
do
display
=
""
resolution
=
""
test
-d
/proc/
$pid
||
continue
cat
/proc/
$pid
/cmdline |
tr
'\0'
'\n'
|
head
-n1
|
grep
/bin/Xvfb
\$
>
/dev/null 2> /dev/null
||
continue
for
line
in
$(
cat
/proc/
$pid
/cmdline |
tr
'\0'
'\n'
2> /dev/null
)
;
do
if
echo
${
line
}
|
grep
-o
':[0-9]*'
>
/dev/null
;
then
display
=
"
${
line
}
"
fi
if
echo
${
line
}
|
grep
-o
'[0-9]*x[0-9]*x[0-9]*'
>
/dev/null
;
then
resolution
=
"
${
line
%x*
}
"
fi
done
if
[
-n
"
${
display
}
"
]
&&
[
-n
"
${
resolution
}
"
]
;
then
firefox_pid
=
""
for
f_pid
in
$(
ps
-u
$(
id
-u
)
-o
pid
=
)
;
do
test
-d
/proc/
${
f_pid
}
||
continue
cat
/proc/
${
f_pid
}
/cmdline |
tr
'\0'
'\n'
|
head
-n1
|
grep
./firefox
\$
>
/dev/null 2> /dev/null
||
continue
cat
/proc/
${
f_pid
}
/environ |
tr
'\0'
'\n'
|
grep
^DISPLAY
=
${
display
}
\$
>
/dev/null 2> /dev/null
||
continue
firefox_pid
=
"
$f_pid
"
break
;
done
if
[
-z
"
${
firefox_pid
}
"
]
;
then
continue
fi
filename
=
"output
${
firefox_pid
}
.webm"
test
-f
${
filename
}
&&
continue
echo
"xvfb
${
pid
}
${
display
}
${
resolution
}
"
echo
"firefox
${
firefox_pid
}
"
export
DISPLAY
=
${
display
}
"
${
ffmpeg_bin
}
"
-loglevel
error
-r
30
-s
${
resolution
}
-f
x11grab
-i
${
display
}
.0
\
-vf
unpremultiply
=
inplace
=
1
\
-c
:v libvpx-vp9
-lossless
1
\
-f
webm
${
filename
}
&
ffmpeg_pid
=
$!
sleep
5
if
!
test
-f
${
filename
}
;
then
kill
${
ffmpeg_pid
}
continue
fi
echo
run ffmpeg
$ffmpeg_pid
while
true
;
do
if
!
[
-d
"/proc/
${
firefox_pid
}
"
]
;
then
echo
"kill ffmpeg
$ffmpeg_pid
"
kill
${
ffmpeg_pid
}
exit
fi
sleep
0.2
done
&
fi
done
sleep
1
done
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