wireadmin/bin/logs

17 lines
351 B
Plaintext
Raw Normal View History

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