-n Exceeded

Hello All,

We have one cron job running in every 15-20 seconds and this cron is setup/associated via qad menu..each time this cron runs it calls a .p program...but here whenever this cron runs, it increases number of user sessions and exceeded -n.

I think, every time cron runs will open the QAD menu (in backside) and doesnt close it prior running the cron again.

Kindly suggest.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
The -n parameter determines the number of possible concurrent connections to the database. If a cron job is running a Progress executable (e.g. _progres) which runs a .p, this .p needs to be written in a way that it will disconnect from the database when it has completed its work. Also, the cron job needs to be written in a way that these jobs won't pile up if the duration of the job exceeds the job's period of repetition. For example you don't want a job that lasts 20 minutes on average to be run every 15 minutes.

If the cron job command line is just a Progress command line, change it to a shell script that has some logic to check first if the job is already running. If it is, end the script. If it isn't, run the Progress code.
 

Cecil

19+ years progress programming and still learning.
In my bash/shell scripts I have the following script which checks to make sure the process is not already running before executing. It's simple in what is does.

Code:
PIDFILE=/var/tmp/progressCronJob.pid
RETURNCODE=-1


if [ -f $PIDFILE ]
then
  PID=$(cat $PIDFILE)
  ps -p $PID > /dev/null 2>&1
  if [ $? -eq 0 ]
  then

    echo "Job is already running" date
    exit 1
  else
    ## Process not found assume not running
    echo $$ > $PIDFILE
    if [ $? -ne 0 ]
    then
      echo "Could not create PID file" `date`
      exit 1
    fi
  fi
else
  echo $$ > $PIDFILE
  if [ $? -ne 0 ]
  then
    echo "Could not create PID file" `date`

    exit 1
  fi
fi

#...
#INSERT YOUR PROGRESS COMMAND HERE.
#...

#Get the return code of the executable which has just run.
RETURNCODE=$?

#remove the pid file
rm $PIDFILE
return $RETURNCODE
 
Top