Automating the install of PostgreSQL from Shell
I recommend using psql -c command for the first invocation of psql, or better yet, just use the createuser command.

For the second invocation, you might want psql -f /etc/schema.sql.  I would also suggest using the --single-transaction flag, so that in the unlikely event of an error, the failure will be blatantly obvious since the spider database will be empty.  (I assume you will also create a database named spider sometime before trying to import data into it.)