Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
labmanager-systemd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto LIVIO BECCARIA
labmanager-systemd
Commits
04c183da
Commit
04c183da
authored
2 weeks ago
by
bta
Browse files
Options
Downloads
Patches
Plain Diff
Add a screendump service.
parent
a180927f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/screendump
+68
-0
68 additions, 0 deletions
bin/screendump
install-labmanager.sh
+2
-1
2 additions, 1 deletion
install-labmanager.sh
systemd/esame-screendump.service
+13
-0
13 additions, 0 deletions
systemd/esame-screendump.service
with
83 additions
and
1 deletion
bin/screendump
0 → 100755
+
68
−
0
View file @
04c183da
#!/bin/bash
# Step by step output as the script runs, until we are confident enough
set
-x
DATE
=
`
date
+%Y-%m-%dT%H:%M:%S
`
BASEDIR
=
/local/sdump
start
()
{
# Prepare the output directory
mkdir
-p
"
${
BASEDIR
}
"
chmod
700
"
${
BASEDIR
}
"
chown
-h
sdump:sdump
"
${
BASEDIR
}
"
# Ask the system to clean old files
if
[
!
-f
/etc/tmpfiles.d/sdump.conf
]
;
then
echo
'q /local/sdump 700 sdump sdump 60d'
>
/etc/tmpfiles.d/sdump.conf
fi
# Wait for the .Xauthority file
while
[
!
-f
"/local/
${
ESAME_USER
}
/.Xauthority"
]
;
do
sleep
5
done
# Wait for the new token
sleep
10
# Copy the X11 token
cp
"/local/
${
ESAME_USER
}
/.Xauthority"
~sdump/
chown
-h
sdump:sdump ~sdump/.Xauthority
# Fake it 'till you make it
ln
-s
/usr/bin/ffmpeg ~sdump/[sysdump]
# Hide processes
mount /proc/
-o
remount,hidepid
=
2
# Start the screen dump
#CMD="ffmpeg -framerate 1 -f x11grab -i :0.0 -vcodec libx265 -crf 28 \"${BASEDIR}/${DATE}.mkv\""
#CMD="ffmpeg -framerate 1 -f x11grab -i :0.0 -vcodec libx265 -crf 28 -vf \"drawtext='text=%{localtime\:%X}:fontsize=32:fontcolor=red'\" \"${BASEDIR}/${DATE}.mkv\""
CMD
=
"PATH=
\"
$PATH
:.
\"
[sysdump] -framerate 1 -f x11grab -i :0.0 -vcodec libx265 -crf 28 -vf
\"
drawtext='text=%{localtime
\:
%X}:fontsize=32:fontcolor=red'
\"
\"
${
BASEDIR
}
/
${
DATE
}
.mkv
\"
"
su - sdump
-c
"
${
CMD
}
"
}
stop
()
{
# Send a SIGTERM to ffmpeg to stop the screen dump
pkill
-u
sdump ffmpeg
# Give ffmpeg time to finalize the file
sleep
10
}
case
"
$1
"
in
'start'
)
start
;;
'stop'
)
stop
;;
'restart'
)
stop
start
;;
*
)
echo
"Usage:
$0
{ start | stop | restart }"
;
exit
1
;
;;
esac
exit
0
This diff is collapsed.
Click to expand it.
install-labmanager.sh
+
2
−
1
View file @
04c183da
...
...
@@ -9,13 +9,14 @@ ESAME_DIR=/opt/esame
BIN_FILES
=(
"desktop-wallpaper"
"esamesync-esame.sh"
"firefox-home"
"get-config"
"iptables-rules"
"lightdm-autologin"
"kioskmode"
"mk-homedir"
"nfs"
"usb"
"virtualbox"
"rabbitmq-client.py"
"screendump"
)
SYSTEMD_FILES
=(
"esame-desktop-wallpaper.service"
"esame-firefox-home.service"
"esame-get-config-boot.service"
"esame-get-config.service"
"esame-iptables-rules.service"
"esame-dm-autologin.service"
"esame-kioskmode.service"
"esame-mk-homedir.service"
"esame-nfs.service"
"esame-usb.service"
"esame-virtualbox.service"
"esamesync-esame.service"
"esame-get-config.timer"
"esame-configurator.target"
"esame.target"
"esamekiosk.target"
"esameshow.target"
"esame-multi-user.target"
"esame-rabbitmq-client.service"
"esame-rabbitmq-client.service"
"esame-screendump.service"
)
USBGUARD_OVERRIDE_FILES
=(
...
...
This diff is collapsed.
Click to expand it.
systemd/esame-screendump.service
0 → 100644
+
13
−
0
View file @
04c183da
[Unit]
Description
=
Dump the screen
After
=
esame-mk-homedir.service esame-desktop-wallpaper.service esame-firefox-home.service esame-virtualbox.service
[Service]
Type
=
exec
EnvironmentFile
=
-/local/esame-machine.conf
ExecStart
=
/usr/libexec/labmanager/screendump start
ExecStop
=
/usr/libexec/labmanager/screendump stop
TimeoutStopSec
=
120
[Install]
WantedBy
=
esame.target esamekiosk.target esameshow.target
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