two questions about incorporating fortune and java uptime into screen for a minecraft server

existing code

#!/bin/bash
SRC_DIR=/home/brian/mc/
DEST_DIR=/home/brian/mcbak/
SCREEN_SESSION=minecraft
BACKUP_LOG=/home/brian/mcbaklog
CHKBAK=$(rdiff-backup -v3 --verify ~/mcbak)
BAKSZ=$(du -sh ~/mcbak|awk 'FNR == 1 {print $1}')
WLDSZ=$(du -sh ~/mc/world/|awk 'FNR == 1 {print $1}')
UPTIME_DAYS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 / 86400)
UPTIME_HOURS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 / 3600)
UPTIME_MINUTES=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 % 3600 / 60)
FORT=$(/usr/games/fortune)

UPTIME=$(uptime | sed 's/.*up \([^,]*\), .*/\1/')


if [ : ]; then
        START_TIME=$(date +%s)
        screen -p 0 -S ${SCREEN_SESSION} -X stuff "`printf "say Begin mindray transmission:\r"`"
        screen -p 0 -S ${SCREEN_SESSION} -X stuff "`printf "say Current Server Uptime:$ UPTIME_DAYS days, $UPTIME_HOURS hours, $UPTIME_MINUTES minutes. Current World Size: ${WLDSZ}. \r"`"
		screen -p 0 -S ${SCREEN_SESSION} -X stuff "`printf "say Backup starting...\r"`"
        rdiff-backup -v5 --print-statistics ${SRC_DIR} ${DEST_DIR} >> ${BACKUP_LOG}
        END_TIME=$(date +%s)
        DIFF=$(( ${END_TIME} - ${START_TIME} ))
        screen -p 0 -S ${SCREEN_SESSION} -X stuff "`printf "say Backup finished, and took ${DIFF} seconds to complete.\r"`"    
    
        echo "`date`: rdiff-backup finished, took ${DIFF} seconds to complete " >> ${BACKUP_LOG}
		
        exit 0
fi




what I would like to do is two things.
first would be to add java uptime to print the same as the server uptime.

So far I have

brian@pufffy:~$ ps -C java|awk 'FNR == 2 {print $3}'

This returns

[quote]

00:14:43

how can I print this out with simular output to

UPTIME_DAYS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 / 86400)
UPTIME_HOURS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 / 3600)
UPTIME_MINUTES=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 % 3600 / 60)
====
        screen -p 0 -S ${SCREEN_SESSION} -X stuff "`printf "say Current Server Uptime:$ UPTIME_DAYS days, $UPTIME_HOURS hours, $UPTIME_MINUTES minutes. Current World Size: ${WLDSZ}. \r"`"

This returns

Current Server Uptime is 0 days 0 hours 0 minutes

and I would like to print java uptime the same way.

About fortune
I would love to print the output to a screen session in the same format as the above code. I have no idea how to do this or if it possible. The problem is the screen session is running a minecraft server and the syntax is "Say insert message here: carriage return" and the text input is limited to about 110 char so lets say 100 to be safe with 4 on the front for "say ". Also it hates tabs indentation and most formatting and will not return correctly with this. It only likes plain txt and carriage returns. Its based in java so I do not know if that helps figure out text encoding.

I would LOVE to be able to put

FORT=$(/usr/games/fortune)

into

screen -p 0 -S ${SCREEN_SESSION} -X stuff "`printf "say Backup starting...\r"`"

within the above mentioned formatting. I will give you full credit in the script if you pull this off!
and me and my players will enjoy this very much!

Thanks in advance for any feedback or help!

---------- Post updated at 12:44 AM ---------- Previous update was at 12:41 AM ----------

the hostname of the machine is puffy because I was using freebsd for bit and switched to ubuntu and the hostname carried over. lol.

---------- Post updated at 12:57 AM ---------- Previous update was at 12:44 AM ----------

how do I edit this????

You edit a post by clicking the edit button.

VAR=$(ps -C java|awk 'FNR == 2 {print $3}')
OLDIFS="$IFS"
IFS=":"
set -- $VAR
IFS="$OLDIFS"

echo "$1 days $2 hours $3 minutes"

I don't know enough about screen to add much about your other question.