Advertisement
devinteske

viznet.sh

Apr 14th, 2018
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.02 KB | None | 0 0
  1. #!/bin/sh
  2. pgm="${0##*/}" # Program basename
  3. [ $# -gt 0 ] || { echo "Usage: $pgm [ssh_options] ssh_host" >&2; exit 1; }
  4. GOURCE_OPTIONS="
  5.     --1280x800 --auto-skip-seconds 1 --bloom-intensity 0.25
  6.     --file-idle-time 2 --highlight-users --log-format custom
  7.     --output-ppm-stream - --seconds-per-day 0.01
  8. " # END-QUOTE
  9. FFMPEG_OPTIONS="
  10.     -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264
  11.     -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0
  12. " # END-QUOTE
  13. ssh "$@" sh - <<'EOF' | awk '{
  14.     (cmd = sprintf("date -jf \"%s\" \"%s\" +%%s", "%Y %b %e %T",
  15.         datetime = substr($0, 1, 20))) | getline epoch
  16.     close(cmd)
  17.     printf "%s|%s|M|/%s/%s\n", epoch,
  18.         remoteip = $9, iface = $6, localip = $7
  19. }' | gource $GOURCE_OPTIONS - | ffmpeg $FFMPEG_OPTIONS "${pgm%.*}.mp4"
  20. ################################################## REMOTE SCRIPT
  21. remote=$( sockstat | awk -v pid=$PPID '$3==pid && $5~/^tcp/{print $NF; exit}' )
  22. addr="${remote%:*}"
  23. case "$addr" in
  24. *:*) addr="[$addr]" ;;
  25. esac
  26. dwatch -X ip -t "this->remote != \"$addr\""
  27. EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement