aboutsummaryrefslogtreecommitdiffhomepage
path: root/threadcat-list.sh
blob: 6db8ae649600ed6b6f043254ae06a40f7d0b8ca6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

BOARD=$1

LISTING_HEADING="~~~~~~~~~~~~~~~~~~~"


export CURTIME=`ssh $THREADCAT_USER date +%s`

if [ -z "${BOARD}" ]; then
    echo "BOARDS"
    echo $LISTING_HEADING
    ssh $THREADCAT_USER "ls -lt /opt/threadcat | grep ^d" | awk '{print $9;}'
    echo ""
    echo "TOP LEVEL THREADS"
    echo $LISTING_HEADING
    ssh $THREADCAT_USER "ls -lt --time-style=+%s /opt/threadcat" | \
        grep -v ^d | egrep -v '^total [0-9]+$' | \
        awk '{ mins = (ENVIRON["CURTIME"] - $6) / (60*60); printf "%.0f hrs ago -- %s\n", mins, $7;}'
else
    echo "BOARD: $BOARD"
    echo $LISTING_HEADING
    ssh $THREADCAT_USER "ls -lt --time-style=+%s /opt/threadcat/$BOARD" | \
        grep -v ^d | egrep -v '^total [0-9]+$' | \
        awk '{ mins = (ENVIRON["CURTIME"] - $6) / (60*60); printf "%.0f hrs ago -- %s\n", mins, $7;}'
fi