Scheduling of tasks in ScriptCase.

Hello Friends,

I am working on an application which sends notification emails to clients automatically as per scheduling. I am using ScriptCase v6 for that purpose, so am I have any option so that I can execute a single blank form or any code on particular time automatically. We can do it using cron tab command also, but how can we do it without this command. There is no problem to use this command but I just want to do it very simply so that any dumb user should set it on few clicks.

Any solution on this? Appreciates for reply.


Milind

You can only set as Cron Job to do it automatically.

Another bad solution is to check if there is an expired task to execute onLoad of the application. But using this method its executed by the user so you cant control a real date time to be executed.

Can you explain what do you mean by expired task? Can we use threading here?


Milind

Example,

On your task table fields:

  • id_task: primary key
  • date_to_execute: date to run this task
  • active: 1 to active, 0 to inactive

OnLoad of your scriptcase app:

#check your active task onload
Select * from task where date_to_execute < NOW() and active=1

when you run your active task mark it as inactive

Every time that an user run that app will check active task to run where date_to_execute < current date.

Note: i dont recommend that way, its better with cronjobs, because if you have a task to run lets say on monday and no one run your sc app on monday that task will not run until a user run your sc app.

Using cronjobs you can set to run a task on any date/hour without user interaction.

Hello again,
Now I changed my mind and I want to execute a blank application using crontab in my Linux machinne, I used following command and appended the line in the file. The blank application emailPostman is one which executes in browser and sends email to configured email address from other configured email address.

sudo crontab -e -u www-data

01 * * * * cd /opt/nm/v6/www/scriptcase/app/IRS/emailPostman/ php -f emailPostman.php

The problem is the cronjob is not sending email, neither when used command php -f emailPostman.php from the application directory sends email. What can I do to send emails?

Thanking you for reply.

I have never figured out how to get a Scriptcase application to run from the PHP executable… I can get it to look like its running without error… but as you found nothing actually happens in the script other than I see some CSS to the screen.