gusl: (Default)
[personal profile] gusl
I'm trying to make a shell-script that:

* runs files from a dataset, one by one (for each file, there will be one call to java)

* but after 5 minutes in the same file, it gives up and runs the next one.

Any tips about how to make this concurrency?

(no subject)

Date: 2006-09-28 04:11 pm (UTC)
From: [identity profile] ernunnos.livejournal.com
You could use ulimit for cpu time.

(no subject)

Date: 2006-09-28 07:47 pm (UTC)
tiedyedave: (Default)
From: [personal profile] tiedyedave
I would suggest Orc, and indeed it would be quite simple:

RunFiles(nil)  = 0
RunFiles(F:FS) = let(run(F) | Timer(300)) >> RunFiles(FS)


...but Orc doesn't have a functioning implementation yet. :(

(no subject)

Date: 2006-09-29 03:20 am (UTC)
From: [identity profile] darius.livejournal.com
Fork two children: one sleeps for 300, one execs java. The parent waits for either child, then kills the other. (All of the preceding verbs are Unix system calls. I don't know if you can do it all in the shell.)

Been there done that

Date: 2006-09-29 01:27 pm (UTC)
From: [identity profile] fare.livejournal.com
I once wrote a zsh script to poll my internet connection, and if it failed, kill the adsl daemon and re-run it. It was *hell* to debug. But in the end it was kind of working. It must be somewhere in one of my backups, if you want me to dig into it...

It notably used zsh's coproc thingie to implement some kind of interprocess communication whereby the winning subprocess could atomically announce "the activity I have been watching ended with success|failure". Horrible. You cannot just spawn a child -- you must spawn a watcher, who spawns the child and reports to the arbiter.

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags