10-24-2007
What you could do is have a temporary file which is created when you start to run a script, then you delete when the script finishes.
You then have a single loop with a sleep which looks at what temporary files exist and then decides what should be started.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello all,
How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename.
Any assistance is most appreciated.
Thanks,
Jim... (10 Replies)
Discussion started by: jleavitt
10 Replies
2. Programming
I have made a shell that accept a command and parameters. It is working properly. I have tryed to implement background process in main(). But i dont know to implement them. Can anyone give me a lille example??
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* The following... (3 Replies)
Discussion started by: badshah
3 Replies
3. Shell Programming and Scripting
Hi Guys,
I am facing some weird problem with my shell script. The script shows up a menu and for every ontion internally calls a shell script which start/stop various servers. When I am using '&' while calling the internal shell script so that the server run in the background. For exiting... (1 Reply)
Discussion started by: agoyal
1 Replies
4. Shell Programming and Scripting
Hi,
In shell script when I use
script1 >> filelog
the echo statments of script1 gets printed in the filelog
but when I try to run script in background i.e,
script1 & >> filelog
nothing gets printed in the filelog.
Anybody knows whats going on here.
thanks (3 Replies)
Discussion started by: k_oops9
3 Replies
5. UNIX for Dummies Questions & Answers
How, can I hide background process's output? (5 Replies)
Discussion started by: zylwyz
5 Replies
6. Shell Programming and Scripting
can anybody plz tell me
how can i find the background processes running. (2 Replies)
Discussion started by: Raom
2 Replies
7. Shell Programming and Scripting
How to create a backgrond processes ? (5 Replies)
Discussion started by: anupdas
5 Replies
8. UNIX for Dummies Questions & Answers
What I need to learn is how to use a script that launches background processes, and then kills those processes as needed.
The script successfully launches the script. But how do I check to see if the job exists before I kill it?
I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies
9. Shell Programming and Scripting
Hi,
I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming.
So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies
10. Shell Programming and Scripting
Hi,
I have written a menu driven shell script in which as per the choice, I run the another script on background.
For eg:
1. get info
2)process info
3)modify info
All the operations have different scripts which i schedule in background using &.
However I wish to display the error... (0 Replies)
Discussion started by: ashima jain
0 Replies
TEMPNAM(3) 1 TEMPNAM(3)
tempnam - Create file with unique file name
SYNOPSIS
string tempnam (string $dir, string $prefix)
DESCRIPTION
Creates a file with a unique filename, with access permission set to 0600, in the specified directory. If the directory does not exist or
is not writable, tempnam(3) may generate a file in the system's temporary directory, and return the full path to that file, including its
name.
PARAMETERS
o $dir
- The directory where the temporary filename will be created.
o $prefix
- The prefix of the generated temporary filename.
Note
Windows uses only the first three characters of prefix.
RETURN VALUES
Returns the new temporary filename (with path), or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 4.0.3 | |
| | |
| | This function's behavior changed in 4.0.3. The |
| | temporary file is also created to avoid a race |
| | condition where the file might appear in the |
| | filesystem between the time the string was gener- |
| | ated and before the script gets around to creat- |
| | ing the file. Note, that you need to remove the |
| | file in case you need it no more, it is not done |
| | automatically. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
tempnam(3) example
<?php
$tmpfname = tempnam("/tmp", "FOO");
$handle = fopen($tmpfname, "w");
fwrite($handle, "writing to tempfile");
fclose($handle);
// do here something
unlink($tmpfname);
?>
NOTES
Note
If PHP cannot create a file in the specified $dir parameter, it falls back on the system default. On NTFS this also happens if the
specified $dir contains more than 65534 files.
SEE ALSO
tmpfile(3), sys_get_temp_dir(3), unlink(3).
PHP Documentation Group TEMPNAM(3)