Skip to main content

[archive] script runtime and kill signal

  • January 7, 2010
  • 5 replies
  • 0 views

[Migrated content. Thread originally posted on 10 December 2009]

Hello everyone,
here's my problem:
I've AcuRcl that launches (using SERVER_RUNTIME cfg variable) a shell script that does some things (mainly sets some env variable and its exports) and than starts runcbl.
Now if I send an acurcl -kill -p nnnn where nnnn=PID of runcbl I've no effect, and this is an expected behaviour 'cos runcbl is child of shell script, but if nnnn=PID of shell script than script shut down but runcbl still lives and I've to use a kill -9 xxxx where xxxx=PID of runcbl to shut it down.
Has anyone any suggestion to for change script to recieve acurcl -kill signal and pass down to runcbl and close it cleanly?
Thanks in Advance Gio

5 replies

[Migrated content. Thread originally posted on 10 December 2009]

Hello everyone,
here's my problem:
I've AcuRcl that launches (using SERVER_RUNTIME cfg variable) a shell script that does some things (mainly sets some env variable and its exports) and than starts runcbl.
Now if I send an acurcl -kill -p nnnn where nnnn=PID of runcbl I've no effect, and this is an expected behaviour 'cos runcbl is child of shell script, but if nnnn=PID of shell script than script shut down but runcbl still lives and I've to use a kill -9 xxxx where xxxx=PID of runcbl to shut it down.
Has anyone any suggestion to for change script to recieve acurcl -kill signal and pass down to runcbl and close it cleanly?
Thanks in Advance Gio
In the shell script, where it starts runcbl, use the unix "exec" command. This will cause runcbl to essentially replace the shell script, and use its PID.

Currently, you probably have something similar to this:
#!/bin/ksh
export VAR1=xxxx
export VAR2=yyyy
runcbl myprog

When acurcl runs this script, the script will have one PID, and runcbl will have another. Both processes continue to run until runcbl exits.

Here, I've just added the exec command:
#!/bin/ksh
export VAR1=xxxx
export VAR2=yyyy
exec runcbl myprog

When acurcl runs this script, it gets a PID, but at the exec runcbl line, the script terminates and is replaced by runcbl using the same PID. The runcbl still inherits the environment created by the shell script.

I don't know if this will completely solve the issue with the acurcl -kill command, but it should get you a step closer. Plus, it reduces system resources, especially with a large number of users. In the first case, for each user there will be both a runcbl process and a ksh process (or whatever shell you use), both running for the duration of the program. In the second case, you only have the runcbl process for each user.

[Migrated content. Thread originally posted on 10 December 2009]

Hello everyone,
here's my problem:
I've AcuRcl that launches (using SERVER_RUNTIME cfg variable) a shell script that does some things (mainly sets some env variable and its exports) and than starts runcbl.
Now if I send an acurcl -kill -p nnnn where nnnn=PID of runcbl I've no effect, and this is an expected behaviour 'cos runcbl is child of shell script, but if nnnn=PID of shell script than script shut down but runcbl still lives and I've to use a kill -9 xxxx where xxxx=PID of runcbl to shut it down.
Has anyone any suggestion to for change script to recieve acurcl -kill signal and pass down to runcbl and close it cleanly?
Thanks in Advance Gio
In the shell script, where it starts runcbl, use the unix "exec" command. This will cause runcbl to essentially replace the shell script, and use its PID.

Currently, you probably have something similar to this:
#!/bin/ksh
export VAR1=xxxx
export VAR2=yyyy
runcbl myprog

When acurcl runs this script, the script will have one PID, and runcbl will have another. Both processes continue to run until runcbl exits.

Here, I've just added the exec command:
#!/bin/ksh
export VAR1=xxxx
export VAR2=yyyy
exec runcbl myprog

When acurcl runs this script, it gets a PID, but at the exec runcbl line, the script terminates and is replaced by runcbl using the same PID. The runcbl still inherits the environment created by the shell script.

I don't know if this will completely solve the issue with the acurcl -kill command, but it should get you a step closer. Plus, it reduces system resources, especially with a large number of users. In the first case, for each user there will be both a runcbl process and a ksh process (or whatever shell you use), both running for the duration of the program. In the second case, you only have the runcbl process for each user.

[Migrated content. Thread originally posted on 10 December 2009]

Hello everyone,
here's my problem:
I've AcuRcl that launches (using SERVER_RUNTIME cfg variable) a shell script that does some things (mainly sets some env variable and its exports) and than starts runcbl.
Now if I send an acurcl -kill -p nnnn where nnnn=PID of runcbl I've no effect, and this is an expected behaviour 'cos runcbl is child of shell script, but if nnnn=PID of shell script than script shut down but runcbl still lives and I've to use a kill -9 xxxx where xxxx=PID of runcbl to shut it down.
Has anyone any suggestion to for change script to recieve acurcl -kill signal and pass down to runcbl and close it cleanly?
Thanks in Advance Gio
Hi, thank You for the answer and my apologies for this late response.
I solved another way:
1) I used the USE_UNIX_SHELL 1 acurcl.cgf variable
2) I set up a profile.local in /etc to set up the correct env for user.
As soon I'll have a bit of time I'll try your solution and than I'll report the result.
Thanks Gio.

[Migrated content. Thread originally posted on 10 December 2009]

Hello everyone,
here's my problem:
I've AcuRcl that launches (using SERVER_RUNTIME cfg variable) a shell script that does some things (mainly sets some env variable and its exports) and than starts runcbl.
Now if I send an acurcl -kill -p nnnn where nnnn=PID of runcbl I've no effect, and this is an expected behaviour 'cos runcbl is child of shell script, but if nnnn=PID of shell script than script shut down but runcbl still lives and I've to use a kill -9 xxxx where xxxx=PID of runcbl to shut it down.
Has anyone any suggestion to for change script to recieve acurcl -kill signal and pass down to runcbl and close it cleanly?
Thanks in Advance Gio
Hi, thank You for the answer and my apologies for this late response.
I solved another way:
1) I used the USE_UNIX_SHELL 1 acurcl.cgf variable
2) I set up a profile.local in /etc to set up the correct env for user.
As soon I'll have a bit of time I'll try your solution and than I'll report the result.
Thanks Gio.

[Migrated content. Thread originally posted on 10 December 2009]

Hello everyone,
here's my problem:
I've AcuRcl that launches (using SERVER_RUNTIME cfg variable) a shell script that does some things (mainly sets some env variable and its exports) and than starts runcbl.
Now if I send an acurcl -kill -p nnnn where nnnn=PID of runcbl I've no effect, and this is an expected behaviour 'cos runcbl is child of shell script, but if nnnn=PID of shell script than script shut down but runcbl still lives and I've to use a kill -9 xxxx where xxxx=PID of runcbl to shut it down.
Has anyone any suggestion to for change script to recieve acurcl -kill signal and pass down to runcbl and close it cleanly?
Thanks in Advance Gio
Hi, thank You for the answer and my apologies for this late response.
I solved another way:
1) I used the USE_UNIX_SHELL 1 acurcl.cgf variable
2) I set up a profile.local in /etc to set up the correct env for user.
As soon I'll have a bit of time I'll try your solution and than I'll report the result.
Thanks Gio.