Created
July 19, 2017 10:08
-
-
Save ChatchaiJ/12985f511223ddc489c03cf6c7ec5729 to your computer and use it in GitHub Desktop.
Using scrot to capture screen and send that screen capture image by Telegram bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BINDIR="${HOME}/bin" | |
WORKDIR="/tmp/capture" | |
SENDPHOTO="$BINDIR/botSendPhoto" # see botSendPhoto.sh script | |
## mode 777 is needed since we capture screen as 'pi' user | |
[ ! -d $WORKDIR ] && mkdir -m 0777 -p $WORKDIR | |
cd $WORKDIR || exit | |
CAPTION="`hostname` screen capture `date +%Y%m%d_%H%M%S`" | |
## This is run as 'pi' user on raspberry pi raspbian ## | |
DISPLAY=:0.0 sudo -u pi scrot -z -d 5 -q 25 capture.png | |
# Caption ImageFile To | |
$SENDPHOTO "$CAPTION" capture.png $USER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment