boinc/stripchart/samples/count_users

24 lines
550 B
Tcsh
Executable File

#! /bin/csh
# where is mysql located?
set MYSQL = /usr/local/mysql/bin/mysql
# what is the name of the database?
set DATABASE = mysql
# what is the name of the table you wish to count?
set TABLE = user
# tmpfile for sql
set TMPFILE = /tmp/count$$.sql
echo "use $DATABASE;" > $TMPFILE
echo "select count(*) from $TABLE;" >> $TMPFILE
set COUNT = `cat $TMPFILE | $MYSQL | /bin/tail -1`
set CIVDATE = `/bin/date "+%c:%m:%d:%H:%M" | awk '{print $5}'`
set UNIXDATE = `/usr/local/bin/perl -e 'print time()'`
echo $CIVDATE $UNIXDATE $COUNT