It’s not so pretty and Oracle has the Oracle Restart services for that. But to a temporary and quick need, this script solve the problem:
if ps -fu oracle | grep -v grep | grep ora_smon_orcl >/dev/null then echo "orcl instance is up and running" else echo "orcl instance is down" sqlplus /nolog > /dev/null 2>&1 <<EOF conn / as sysdba startup exit EOF fi
Matheus.