I want to write something that restarts the httpd service when my apache server dies

You need something like this:

#!/bin/bash
#test-httpd.sh
client="yourname"
mailboxes="[email protected]"
# write to that file
monitorfile="/var/www/html/monitor.php"

#empty monitor.php
> $monitorfile

APACHE=`/bin/pidof httpd`
echo $APACHE

if [ "$APACHE" == "" ]
   then
    echo APACHE_FAILURE  | mail -s "$client"": CRITICAL : APACHE FAILURE !!!!" $mailboxes
#trying to restart it
    /etc/init.d/httpd stop
    /etc/init.d/httpd start
    echo -e "apache:FAIL\n" >> $monitorfile
else
    echo -e "apache:OK\n" >> $monitorfile
fi

Lastly, you need a cron job, that will execute this script test-httpd.sh every minute.

This may be in your crontab

#check httpd
* * * * *   root    /opt/misc/test-httpd.sh  > /dev/null 2>&1