If you see fewer posts. . .

it's because I don't post much anymore.

Friday, June 15, 2007

Latest Buddy Board Update


#! /bin/bash
# this program decides who can buddy out
# users write their names to a file called buddy_request
#
# at a given time, say 9:30 am, the number of people buddied in is determined
#
clear
buddied_in=$(cat /var/www/html/buddy/avail/*.txt |grep in |wc -l |sed 's/ *//g')
# echo $buddied_in

#remove blank spaces in a file
# sed 's/ *//g'

echo There are $buddied_in people buddied in.
#the buddy_history list is sorted and counted to determine the people who have buddied out the least.

# calculate the day and the number of people that can buddy out
#
datenow=`date`
day=`echo $datenow | cut -b1-3`
# The line that follows is unnecessary.
# echo $day

# was if [ $day -eq Mon ]
if [ $day = Mon ]
then
echo Today is Monday.
can_buddy_out=$(echo $buddied_in - 8 | bc -l)
elif [ $day = Tue ]
then
echo Today is Tuesday.
can_buddy_out=$(echo $buddied_in - 9 | bc -l)
elif [ $day = Wed ]
then
echo Today is Wednesday.
can_buddy_out=$(echo $buddied_in - 9 | bc -l)
elif [ $day = Thu ]
then
echo Today is Thursday.
can_buddy_out=$(echo $buddied_in - 9 | bc -l)
elif [ $day = Fri ]
then
echo Today is Friday.
can_buddy_out=$(echo $buddied_in - 8 | bc -l)
fi


echo $can_buddy_out person can buddy out.

# The buddy_history files is sorted and counted to determine who has not buddied out lately.
# The next line explicitly shows the top 2 people in the list.
# sort buddy_history | uniq -c | sort +0n +1d |cut -b9-20| sed 2q
sort buddy_history | uniq -c | sort +0n +1d |cut -b9-20| sed "$can_buddy_out"q

2 comments:

Heather 6/15/2007 07:52:00 PM  

Kurt, I can safely say that I have no idea what you are talking about.

Jeff and Charli Lee 6/17/2007 08:53:00 AM  

I liked your article that Sandy referenced today - although I didn't read the entire thing because I don't need an IPP solution - YET. But maybe someday you can give me advice on how to print APF overlays using a virtual print sessions - if that's possible.

Happy Father's Day guy - from one geek to another.