Highlighted
Absent Member.
Absent Member.
700 views

[archive] script runtime and kill signal

[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
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] script runtime and kill signal

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] script runtime and kill signal

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.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.