I'm using minicom to test my connection on serial port.
sudo minicom -b 115200 -D /dev/ttyS0
Minicom have -S option for executing SCRIPT at startup time,so made a script with your commands like
vi script.txt send atz send at
Run your script with minicom like
minicom -S script.txt
Also refer http://www.linuxcommand.org/man_pages/runscript1.html for minicom scripting