Run a CF program as a background process?
I want to write a ColdFusion program that sends an email to a list of people whenever a particular column in a database is edited. I know how to do this, but I want it to run automatically everyday, rather than me having to run it myself. Is there a way to do this??
Scheduled tasks are a great tool in CF but I wanted to clarify something in your post. Do you want this script (program) to run automatically each day at a set time or do you want it to run only when the DB is updated?
If you just want it to run at a scheduled time, follow Ian and Adam's advice and check into the CF Docs for Scheduled Tasks. They're easy to setup and use ... and quite helpful in so many cases.
If you're looking to have this script run only after your DB column is updated, you may want to take an alternate approach. And there are quite a few options you have available.
A very simple approach would be to just add a CFMAIL tag after you run the update. This assumes that you have some ColdFusion code that processes the update. If this is the case, you could simply add a CFMAIL tag after your update code executes.
<cfquery name="qry" datasource="#dsn#">
update mytable
set col1 = 20
where id = #id#
</cfquery>
<cfmail to="[email protected]" from="[email protected]" subject="data">
<!--- email details --->
</cfmail>
Another option would be to have your DB do the work for you, depending on your DB server that is. You could setup a trigger in your DB (I know MySQL and MS SQL support triggers and email).
Basically, the trigger listens for changes on a specified table and when it detects you have updated a column in the specified table, it will run its code, including sending the email directly from your DB. I only mention this because I just learned how to do it for MySQL and MS SQL and it's pretty fun and cool ... well, 'cool' should probably be in quotes !
Similar Messages
-
How to run a server program in the background on Linux or Windows?
I just finished writing a Java network application with multiple clients and one server.
However, I am not sure how I can run the server (SomeServer.class) in the background on Windows. Also when I am running it on Linux, I don't want it to terminate when I logout of the Linux shell.
To run the server on Linux, should I use a command like this?
nohup java -cp . SomeServer.class > output.txt &
Or is there another command, or perhaps some code that I can add to the program so that it would run in the background automatically and/or continues even when I logout of the Linux shell??
Sometimes, I also like to run the program on a Windows XP machine for testing purpose. How can I do it so that it runs in the background without openning a Console/Command Prompt window??
(redirecting the standard output to a file)
And is there an easy way to create a EXE file that runs the program with the default JRE in windows?On many UNIX systems there's a utility called detach which will launch the following command in such a manner that killing the shell will not kill the process. On systems that lack this command, I'd find an open source implementation and install it.
-
Running a java program in the background
I'm designing a network remote control system in java.
I was wondering does anyone know if it is possible to run an application at the log in screen in windows 2000. There is no GUI and no command prompt.
paddyIf you mean can you run it as a windows 2000 service so the user doesn't see it yes you can.
I recommend the following Java Service wrapper program:
http://www.eworksmart.com/JNT/
It's quite simple to set up and will start when the user logs in (so long as the service is set to start automatically).
Hope that helps,
Seigers. -
How can i run my java program in background process?
hi all,
i am working on desktop monitoring so when i start my program on client machine that is visible to all but i want this program client not visible to all instead of this can be run in background process . so, nobody can see that.
so, how i can do this ?
pls pls help me
thanks in advanced to helper
regards
maulik & riteshthis will run the java program in the background.It'll just use the Windows Java Console instead of the command-line console. It has nothing to do with running as a background process.
Edit: though this might be exactly what the OP wants: not "background process" but "no DOS console". -
Run the SOST transaction in the Background with, or without, a BDC
Hello all,
I was trying to write a Z-Program that would create a BDC that executed Transaction SOST to resend fax messages. It turned out that I could not record the ALV Grid that contains most of the selection/filter criteria functions because those functions exist in the ALV Grid. Some fields exist above the ALV Grid and could be recorded. I record them and used them in my BDC to filter for the faxes I wished sent. I also used a saved layout for the filtering I would have applied if I cold have recorded the ALV Grid.
All seemed well in testing until I attempted to run my Z-Program in the Background. The Z-Program creates the BDC which in tern executes the resending of faxes. I did not realize that the SOST transaction had a completely different screen layout in the Background. That was something pointed out to me when I was instructed to Record the BDC in "Simulate Background Mode". It doesn't seem like I can enter selection criteria in the Background version of the screen at all.
Has anyone been able to run the SOST transaction in the Background with, or without, a BDC? If not has anyone ever automated the SOST functionality in a Z-Program? Can SOST run in the background at all?
ThanksHi,
try to resend it using program RSCONN01.
Regards,
Adrian -
Cannot start background process DTPR_13362_
Hi ,
Whenever DTP is executed in the Dev Server,it throws an error.
Error msg: Cannot start background process DTPR_13362_1 26.09.2011 14:17:44 1 Min. 50 Sec.
while checking the message in the monitor screen the cursor is at this function.
CALL METHOD cl_rsbm_log_step=>raise_step_failed_callstack
Please let me know what needs to be done here so that DTP processed sucessfully.
This is urgently required..thanks..
Regards,
Kalim.Hi
Check how many parallel processes are defined for this DTP.
display the DTP in RSA --> in menu bar click on "goto" --> "settings for batch manager"
In the next screen you will get the number of processes assigned to this DTP.
When you are running this DTP, check these many background processes are available in your system.
If you want you can decrease this number9by default it will be 3)
Regards,
Venkatesh -
How to launch a java program in a new process
Hello !
II have a Java program, in which I want to carry out another Java program but in a new process, this new program requiring the definition of constants to the launching of the JVM.
How can I do it ?
Tank you for your help.Use
Runtime.getRuntime().exec( cmd ); //where cmd is command for run java program.
cmd may be "java test".
You may also try using jnlp to run you java program in a new process.
cmd will be "cmd /c \"javaws " + jnlpFile + "\""; -
I want to run java program on windows environment as background process
Hi all
I want to run java program on windows environment as background processSo command prompt return after executing java command and program on background In Linux we can do this easily �but I do not how to do this in windows
for example look this programe
import java.io.*;
import java.util.*;
public class TestClass {
class ravi extends Thread{
public void run(){
try {
String target_file = "ravind.txt";
File targetfile = new File(target_file);
PrintWriter writer = new PrintWriter(new FileWriter(targetfile)) ;
for (int i =0 ; i < 100 ;i++ ){
Thread.sleep(10000);
writer.println(" ravindra shukla ");
} catch (Exception e) {
e.printStackTrace();
public static void main(String[] args) {
TestClass test1 = new TestClass();
TestClass.ravi r1 = test1.new ravi();
r1.start();
System.out.println(" return from main ");
first i compile this
javac TestClass.java
then i run this by using this command
java TestClass
but becouse i put sleep on threads run function so it takes to much time to get return on command promt .... i want to run this programe as background process so command promt return as soon as i execute java commandThanks dude
This solution �start java TestClass� works fine �. But it does not solve my problem
It opens another black window and that black window persist till the life time of my program
Is it possible application run on complete background without opening another black window �as in Linux -
I want to run background process at plsql program based on the timeout
Hi
when it comes to ready state I want to run background process at plsql program based on the timeout
Thanks and Regards
ch saivikramThanks dude
This solution �start java TestClass� works fine �. But it does not solve my problem
It opens another black window and that black window persist till the life time of my program
Is it possible application run on complete background without opening another black window �as in Linux -
Background processing of Program
Hi all,
I have a requirement of background processing of a program which is called from another program.
Requirement : during execution of Program A, Program B is Submitted to run in background with two field values from Program A.
Is it possible ? I am able to explore it. Please help.
Regards,
NibhaDATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT submitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
System fields
sy-subrc Meaning
0 Background task scheduled successfully.
4 Scheduling cancelled by user on the selection screen.
8 Error during scheduling, i.e. when accessing JOB_SUBMIT internally.
12 Error in internal number assignment. -
How run a report in background process ?
Hi Experts,
I wrote a code in which I am have multiple selection screens....means in first screen there will 3 radio buttons.
So, depending upon the radio button selected, the other selction screen will be displayed...
So, here i want to run a report in background process...But in menubar im not able to find 'program'.
So, please help me this to run my report in background process.. with any simple code...
Thanks,
Rocky.Hi,
Try to see this example and adapt it for your case:
constants : c_jobname like tbtcjob-jobname value 'ZRFC_CM_38',
c_jobclass like tbtcjob-jobclass value 'A',
c_x type c value 'X',
c_msgclass type arbgb value 'ZXXXSD',
c_error type bapi_mtype value 'E',
c_status type bapi_mtype value 'S',
c_msg1 type msgnr value '177',
c_msg2 type msgnr value '178'.
data : v_jobcount like tbtcjob-jobcount.
ranges:
r_auart for vbak-auart,
r_wbstk for vbuk-wbstk,
r_mtart for mara-mtart,
r_reswk for ekko-reswk,
r_vtweg for vbak-vtweg.
call function 'JOB_OPEN'
exporting
jobname = c_jobname
importing
jobcount = v_jobcount
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if sy-subrc = 0.
Assignment of Ranges
append lines of:
distribution_channel to r_vtweg,
order_type_range to r_auart,
status_range to r_wbstk,
material_type_range to r_mtart,
plant_range to r_reswk.
Submit program in background
submit z_beve_salesorder_list
with p_spart = division
with p_file = file_name
with p_land1 = country
with s_vtweg in r_vtweg
with s_auart in r_auart
with s_wbstk in r_wbstk
with s_mtart in r_mtart
with s_reswk in r_reswk
via job c_jobname
number v_jobcount
and return.
Close the Job
call function 'JOB_CLOSE'
exporting
jobcount = v_jobcount
jobname = c_jobname
strtimmed = c_x
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
others = 9.
if sy-subrc = 0.
Status Message
return-type = c_status.
message id c_msgclass
type c_status
number c_msg1
into return-message
with c_jobname
sy-datum
sy-uzeit.
else.
Error Message
return-type = c_error.
message id c_msgclass
type c_error
number c_msg2
into return-message
with c_jobname.
endif.
endif.
Regards. -
Running program in the background
Hi everybody!
I need to run program in the background.
So I need only to change the sy-batch status to 'X'?HI,
if your program is runninn in the Background then the System field SY-BATCH will become 'X' otherwise it will have space ......
it will not execute the job in the background if you put SY-BATCH = 'X'
you need to use: Job_open , Job_submit and job_close function modules
example:
*Submit report as job(i.e. in background)
data: jobname like tbtcjob-jobname value
' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
host like msxxlist-host.
data: begin of starttime.
include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1.
Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
Insert process into job
SUBMIT zreport and return
with p_param1 = 'value'
with p_param2 = 'value'
user sy-uname
via job jobname
number jobcount.
if sy-subrc > 0.
"error processing
endif.
Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays = 1
prdhours = 0
prdmins = 0
prdmonths = 0
prdweeks = 0
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
"error processing
endif.
Thanks
Sudheer -
Can We Run a ABAP Program in Background
Hi,
How to run an ABAP Program in Background.
Points willbe awarded.
Regards,
JayasimhaHi,
<b>Please see this document also
http://help.sap.com/saphelp_nw04/helpdata/en/fa/096ccb543b11d1898e0000e8322d00/content.htm
Easy Job Scheduling Using BP_JOBVARIANT_SCHEDULE</b>
To schedule a job from within a program using the express method, you need only call the BP_JOBVARIANT_SCHEDULE function module.
The express method has the following characteristics:
Simplified job structure: The function module schedules a job that includes only a single job step.
The function module uses default values for most job-processing options. You cannot, for example, specify a target printer as part of the call to the function module. Instead, the job step uses the print defaults of the scheduling user.
Only ABAP reports can be scheduled. You must use the "full-control" method to start external programs.
The range of start-time options is restricted. Event-based scheduling is not supported.
The function module works as follows:
You name the report that is to be scheduled in your call to the function module.
The function module displays a list of variants to the user. The user must select a variant for the report.
You must ensure that the variants required by your users have already been defined.
The user picks either "immediate start" or enters a start date and start time. Optionally, the user can also make the job restart periodically. The job is then scheduled.
Example
You could use the following code to let users schedule report RSTWGZS2 for checking on the status of online documentation:
call function 'BP_JOBVARIANT_SCHEDULE'
exporting
title_name = 'Documentation Check' " Displayed as title of
" of scheduling screens
job_name = 'DocuCheck' " Name of background
" processing job
prog_name = 'RSTWGZS2' " Name of ABAP
" report that is to be
" run -- used also to
" select variants
exceptions
no_such_report = 01. " PROG_NAME program
" not found.
call function 'BP_JOBVARIANT_OVERVIEW' " List the jobs that
exporting " have been scheduled
title_name = 'Documentation Check' " Displayed as title
" of overview screen
job_name = 'DokuCheck' " Jobs with this name
" are listed
prog_name = 'RSTWGZS2'
exceptions
no_such_job = 01.
Regards, ABY -
How to Run Jar in Background process
Hi,
I am develop one application in java,
I have some problem in my application,
whats my problem is, I want to run my jar file
in system background, that is when i was start the system
my jar gets ready to run the application,
Can any one please give some idea to how to run my jar in
background task and how to start the jar when the system
start.
Thanks in advance,
Regards,
Ganesh Kumar.LHi
It has been a while since you asked your question- I hope you still need the solution. Java typically does not support this because it is platform specific. I don't know what operating system you are working on. I assume Windows. There are numerous ways to do this in Windows. The easiest is to copy the program into the startup folder. The directory is: C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Another way, less visible to the user, is to make an entry in the registry. If you place the location of the program as data in a key in HKLM\Software\Microsoft\Windows\Current\Version\Run of the registry, it will start with the system. This is hard to do in Java (for obvious reasons) however it is not impossible. You can use JNI which is really difficult to learn and hard to implement or you can use
Process p=Runtime.getRunTime().exec({"reg.exe","add HKLM..."});This will execute the Windows utility reg.exe with the arguments provided by the second in the array of Strings. Documentation on reg.exe can be found through the command prompt. There are other ways such as modifying Autoexec.bat however they are less reliable
Hope I helped -
Photoshop CS6 still running in Background Processes, won't close
Lately, I've been having a problem with Photoshop CS6 where, even after I close the program, Photoshop.exe is still running under Background Processes in the task manager. Hitting "end task" on the program doesn't do anything. It takes up quite a big portion of my processing power, and it usually closes on its own if I just wait a good 5-10 minutes. Even weirder, while this "Ghost Photoshop" is running in the background, I can launch a new version of Photoshop, that will run at the same time without any trouble (aside from the expected slowness when a chunk of my processing power is being eaten up by whatever Ghost Photoshop is doing). I'm running Photoshop CS6 on Windows 8, with just one extension installed-- Coolorus 2.0.
They were using the little red "x", file > quit allowed her to reopen the program etc. I find it weird that it wont close with the "x" but if I right click the icon on the task bar, it wont allow me to reopen or do anything with it so I was under the assumption it was stuck open.
Maybe you are looking for
-
Help Needed in Zooming and Zooming Out Images in flex
Hi I am using <mx:Zoom /> component to zoom an image! I am able to zoom and Zoom out the Images but when I zoomIn the Image is cropping! Can any one give me the link or code for best zoomin and zoomOut for Images? Is there any way that I can Zoom Vi
-
Failing over after WRITE_ERROR_TO_SERVER exception in sendRequest()
Hi I am getting below error in my issproxy.log file. I wanted to see the source of this URL.cpp file to find out why it is failing. I am not able to open them using DLL decompiler as well. Could anyone tell me where can I get the source code for iisp
-
Can i install Mac OS X Tiger on my Mac Pro?
-
Hi I have configured MT940 format for EBRS (Electronic Bank Reconciliation Statement), when i upload text file, it is not creating a batch input session, Can a text file be uploaed?. Or should it be only in MSG format for the batch input to be cre
-
Material and accounting document on same screen
Dear all, Is there any way to see material document as well as accounting document on same screen?? Thanks Prabhash