wireadmin/bin/logs
Shahrad Elahi d87ba2fc6a fix
2024-04-01 17:04:50 +03:30

17 lines
351 B
Bash

#!/bin/bash
# This script is used for getting last 100 lines of a screen session
SCREEN_NAME="$1"
LIMIT="${2:-100}"
SCRIPT=$(basename "${0}")
if [ -z "$SCREEN_NAME" ]; then
echo "Usage: ${SCRIPT} <screen_name>"
exit 1
fi
screen -S "$SCREEN_NAME" -X hardcopy /tmp/screen-hardcopy
tail -n "${LIMIT}" /tmp/screen-hardcopy
rm /tmp/screen-hardcopy