I'd use either 'at' or 'cron' (unix) to run batch files to carry out whatever you want, either calling psql or a script with a postgres db interface i.e. python, tcl or perl. Theres also a shell call pgbash that may be worth looking into. (http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html)