Getting unique jobid from "at now"


 
Thread Tools Search this Thread
Operating Systems HP-UX Getting unique jobid from "at now"
# 1  
Old 05-28-2009
Getting unique jobid from "at now"

We have a site which uses "at" extensively to submit background tasks. From time to time, we noticed that some jobs were not executing. After some research, we noticed that "at now" would assign the same jobid. Since the jobid is apparently the epoch time, this would happen if 2 (or more) "at now" commands were entered at precisely the same second. So, one job would override (overwrite) the other.

It seems like adding a time offset e.g. "at now +1 minutes" will (or is less likely to) generate unique ids but this would introduce 1-minute delay for almost every job submitted. Since we use this heavily, these delays could quickly add up.

We could also switch from "at now" to "batch" but this would also change the cron queue from "a" to "b". This may have an impact on the current application.

I have seen the MULTI_JOB_SUPPORT option in some versions of HP-UX (PA-RISC 11.11) but it doesn't seem to be available on this particular system (Itanium 11.23). But, even if it were available, the jobid would have a slightly different format.

So, my questions are:
1) Is "at now" supposed to generate unique ids? In other words, is this by design or is it a bug?
2) Is adding an offset really generate unique ids or does it simply reduce the likelihood? In other words, the problem may still occur but much less frequently.

Of course, I'll get in touch with HP Support and ask the question.

Any ideas/suggestions?
# 2  
Old 05-28-2009
On our HPUX box job-id == jobnumber.queuename, job number is epoch time.
You can create any number of queues, one for each system user if you really need it.
Code:
at now -q [queuename] [command]

Does this not work?
# 3  
Old 05-28-2009
This behavior is a bug. The job number is part of a file name which gets created in the AT directory. When the number is allocated, the file should be opened with O_CREAT. If this succeeds, cool. If it fails the job number should be incremented and the open retried. After a few retries, it should give up and tell the user that the queue is full. Creating a unique file name is atomic and has been used to syncronize unrelated unix processes for decades.
# 4  
Old 05-28-2009
See
man 4 queuedefs

The default "at" queue is limited to 4 running jobs.
The man pages suggest that "at" jobs will queue until there is a free slot. In my experience there is a limit to the size of this queue of about 10 jobs before "at" ignores new jobs.
# 5  
Old 05-28-2009
The "at" command must be seriously broken on recent versions of HP-UX if that is true... but I have no access to an HP-UX system to verify that. It should never "ignore" jobs. It should either schedule them or deliver an error message to the user. The size of the queue should really be limited by disk space and ten would be an incredibly small limit. Only 4 jobs can run simultaneously provided that you accept the defaults. queuedefs can be edited though.
# 6  
Old 05-28-2009
Some details...

Jim, we already use different queues for different job types.

methyl, we use multiple job queues and customized queuedefs for our needs. It works...most of the times.

Perderabo, cron doesn't ignore/bypass jobs. It executes all the scheduled jobs. Our problem is we have 2 jobs "sharing" the same jobid. Only one effectively gets executed.

Here's my guess: cron has an internal schedule. When time comes, it goes out and executes the atjobs file, whatever happens to be in there at that time. The atjobs file is then replaced with something else. cron does not detect that, moves on to the next and never looks back. I don't have any documentation to back this up. This is based on what I observed so I may be totally off the track.

In my case, this translates into:

JobA is scheduled and is assigned atjobs/12345678.a (JobA actually gets copied into 12345678.a)
cron sees the job and launches the process. It's removed from the internal list.
JobB is scheduled and is also assigned atjobs/12345678.a. It gets copied to 12345678.a but cron is gone already.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

5. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

ps -ef | grep "string1" "string2" " "string3"

Hi all, can any one suggest me the script to grep multiple strings from ps -ef pls correct the below script . its not working/ i want to print OK if all the below process are running in my solaris system. else i want to print NOT OK. bash-3.00$ ps -ef | grep blu lscpusr 48 42 ... (11 Replies)
Discussion started by: steve2216
11 Replies

8. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

9. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question