From: Bill Thompson (bill.thompson@GOODYEAR.COM)
Date: Thu Nov 20 2003 - 15:57:54 EST
Shawn,
One way to accomplish this is to have a script call itself using a special
command line parameter.
example:
- - - - - snip - - - - -
#!/bin/sh
COMMAND="$(basename $0)"
CMD_DIR="$(dirname $0)"; [[ $CMD_DIR = . ]] && CMD_DIR="$(pwd)"
function Run_Me {
<your real code goes here>
}
if [[ "$1" = "__RUN_ME__" ]]; then
shift
Run_Me
exit 0
else
${CMD_DIR}/${COMMAND} __RUN_ME__ $@ &
fi
- - - - - snip - - - - -
The prompt will return however it will not be listed in the output of
"jobs"
A simple test of the above is to replace "<your real code goes here>" with
"sleep 600"
Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.
Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.
AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
----- Original Message -----
From: "Shawn Bierman" <BiermanS@METHODISTHEALTH.ORG>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Thursday, November 20, 2003 2:17 PM
Subject: script backgrounds itself
> Is it possible to run a script that will background itself without me
manually appending "&" or prepending "at now"?
>
> so something like:
>
> #> ./myjob
> [1] +Running myjob &
> #> jobs
> [1] +Running myjob &
> #>
>
> And the prompt returns but the job still runs.
>
> -shawn
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:22 EDT