LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-11-2007, 02:45 PM   #1
Elguapo
Member
 
Registered: Mar 2005
Distribution: FC7
Posts: 42

Rep: Reputation: 15
Run once tasks


I am working on a web-application and one issue that has come up is scheduling run once tasks. I know this can be done with a cron job but is there a better way to run this task? I have a shell script that I have written that basically accepts any data I pass into it to run these tasks. But I am not quite sure what the best way to schedule the task would be.

Here is a simple example of where I would use this.

1. A user has a transaction document sitting in the gloabl misc inbox.
2. User assigns the transaction document to a transaction
3. Transaction document is moved to transaction file system.
4. Scheduled task occurs and starts the transaction process.

Number 4 is where I would schedule the task to run 15 mins after the user accepts the process.
 
Old 07-11-2007, 02:47 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
would the standard atd daemon not suffice?
 
Old 07-11-2007, 02:53 PM   #3
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Use 'at', as in:

at now + 15 minutes < somejob

Last edited by macemoneta; 07-11-2007 at 02:54 PM.
 
Old 07-11-2007, 03:35 PM   #4
Elguapo
Member
 
Registered: Mar 2005
Distribution: FC7
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by macemoneta
Use 'at', as in:

at now + 15 minutes < somejob

That part I understand, but how do I create somejob. Is it a predefined cronjob, or is it something else?

This is the shell script I need to hit.

/usr/local/bin/cfcCron.sh <instance> <method> etc.....

This job would be created from a web-based front end.
 
Old 07-11-2007, 04:04 PM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
The 'somejob' is just a collection of one or more commands. You could specify the shell script and its parameters as 'somejob'.

Just play with it at the command line.
 
Old 07-11-2007, 04:50 PM   #6
Elguapo
Member
 
Registered: Mar 2005
Distribution: FC7
Posts: 42

Original Poster
Rep: Reputation: 15
Not quite sure if I am formating my command correctly

This is the command I have built inside coldfusion.

/usr/bin/at now + 15 minutes < /usr/local/bin/cfcCron.sh http://muURL.com/ core.papersub.com.PaperlessManager Doc_Parse&docDir=/mnt/instanceName-phx/paperless/active/FC8DA1A2-0EAF-5959-39ECA6999A8CC200/tmp/&transUUID=FC8DA1A2-0EAF-5959-39ECA6999A8CC200


Everything after /usr/local/bin/cfcCron.sh is a parameter I pass to my cfcCron.sh script.

Now when I run this from a terminal window I get this error.

[1] 8406
[2] 8407
[root@www ~]# syntax error. Last token seen: h
Garbled time

[1]- Exit 1 /usr/bin/at now + 15 minutes http://muURL.com/ core.papersub.com.PaperlessManager Doc_Parse </usr/local/bin/cfcCron.sh
[2]+ Done docDir=/mnt/instanceName-phx/paperless/active/FC8DA1A2-0EAF-5959-39ECA6999A8CC200/tmp/
[root@www ~]#

Last edited by Elguapo; 07-11-2007 at 04:52 PM.
 
Old 07-11-2007, 05:20 PM   #7
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
In Unix-like systems, spaces are parameter delimiters, and '&' runs a process in the background. Other special characters are similarly interpreted (see 'man bash'). To use these strings, you need to either escape them with the backslash ('\') or enclose the string in single quotes.

For your command, try:

Code:
echo '/usr/local/bin/cfcCron.sh http://muURL.com/ core.papersub.com.PaperlessManagerDoc_Parse&docDir=/mnt/instanceName-phx/paperless/active/FC8DA1A2-0EAF-5959-39ECA6999A8CC200/tmp/&transUUID=FC8DA1A2-0EAF-5959-39ECA6999A8CC200' | /usr/bin/at now +15 minutes

Last edited by macemoneta; 07-11-2007 at 05:21 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Scheduled tasks gubak Linux - Newbie 3 04-24-2007 02:34 AM
Cron - doesn't seem to run scheduled tasks robintw Linux - General 11 11-25-2005 01:53 AM
Scheduling Tasks How to Haric Linux - Software 8 01-10-2005 02:58 AM
Need some tasks AMDPwred Linux - General 5 02-28-2003 03:22 PM
Scheduled tasks... beserier Linux - General 1 01-24-2003 08:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration