#!/bin/bash

PIDFILE=/home/myappts/public_html/$1$2.pid
#echo $PIDFILE
if [ -f $PIDFILE ]
then
  PID=$(cat $PIDFILE)
  ps -p $PID > /dev/null 2>&1
  if [ $? -eq 0 ]
  then
    echo "Process already running"
    exit 1
  else
    ## Process not found assume not running
    echo $$ > $PIDFILE
    if [ $? -ne 0 ]
    then
      echo "Could not create PID file"
      exit 1
    fi
  fi
else
  echo $$ > $PIDFILE
  if [ $? -ne 0 ]
  then
    echo "Could not create PID file"
    exit 1
  fi
fi
/usr/bin/php /home/myappts/public_html/$1/src/Millietestcron.php
/usr/bin/php /home/myappts/public_html/$1/src/second_set_reminder.php
/usr/bin/php /home/myappts/public_html/$1/src/third_set_reminder.php

rm $PIDFILE