#!/bin/sh

sqlite3 -csv -header /home/dawu/dw.db "select rowid,staffnum,staffname,cardnum,
   departmentname,gatenum,periodofvalitystart,periodofvalityend from staffbasesetting order by rowid desc" > /home/dawu/dwstaff.csv

#output HTTP header
#echo "HTTP/1.0 200 OK\n"
#echo "Server: GoAhead-Webs\r\n"
#echo "Pragma: no-cache"                                          #  "\n" make Un*x happy: but not happy
#echo "Cache-control: no-cache"
#echo "Content-type: application/octet-stream"
#echo "Content-Transfer-Encoding: binary"			
#echo "Content-Disposition: attachment; filename=\"staffbaserecord.csv\""
#echo ""

#echo "#The following line must not be removed."
#echo "Default"
#cat /home/dawu/staffbaserecord.csv 2>/dev/null

