Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to call gtacl routine from OSS from CGI program written in C

649 views
Skip to first unread message

Prashant

unread,
Oct 20, 2013, 12:36:47 PM10/20/13
to
Hello All,

Can you please tell me that how I can call a "gtacl" routine on guardian from CGI program written in C on OSS enviornment.

Thanks in advance.


Keith Dick

unread,
Oct 20, 2013, 4:43:25 PM10/20/13
to
I imagine you are asking how to run a command from your CGI program that you can run using gtacl from an OSS prompt. If that is not what you were asking about, please try to explain further what you actually want to do.

It seems that using the system() function would be the easiest way to do what you ask. Suppose the command you want to run from your CGI program was something that you could do from an OSS shell prompt by entering:

gtacl -c ’stop \$abc’

I believe you could do the same thing in your CGI program by calling the system() function like this:

system("gtacl -c ’stop \$abc’");

I have not used the system() function myself, so there might be some reason why this would not solve your problem. If I'm wrong, I hope someone else will answer and correct what I said here.

If the gtacl command you want to run from your CGI program uses the -p option to run a Guardian program, you could do that by calling the Guardian procedures PROCESS_CREATE_ or PROCESS_LAUNCH_. This would avoid starting a copy of the OSS shell, which would be slightly more efficient, but it would be quite a bit more complicated, since you have many more parameters to pass, and you must send the Guardian process you create a standard startup message sequence. It probably is not worth the extra complexity to use PROCESS_CREATE_ or PROCESS_LAUNCH_.

Robert Hutchings

unread,
Oct 20, 2013, 5:23:43 PM10/20/13
to
As Keith said, the system() call would be the best place to start. Essentially you are invoking a Guardian TACL "session" from the OSS personality. I can double check on this...

Randall

unread,
Oct 20, 2013, 7:05:49 PM10/20/13
to
On Sunday, October 20, 2013 5:23:43 PM UTC-4, Robert Hutchings wrote:
> As Keith said, the system() call would be the best place to start. Essentially you are invoking a Guardian TACL "session" from the OSS personality. I can double check on this...

A bit "gotcha" for using gtacl is that the Guardian disks use $, which for OSS users, bugs up the variable substitution processor. Using ' instead of " is really useful for the gtacl command as shown above.

Also, use the -s option (before -c) to suppress the entire environment being sent down to gtacl. It has limits that are easily passed in complex bash, ksh, cgi, perl, and python environments.

Prashant

unread,
Oct 21, 2013, 2:25:28 AM10/21/13
to
Thanks Keith. I need to write a CGI program using C language. I have TACL routine written on guardian environment. So I have to call same TACL routine by passing few arguments in a CGI program using C language. I hope you got my point.

Regarding, system() I will try with same and let you know if any issues. Thanks.

Prashant

unread,
Oct 21, 2013, 2:29:57 AM10/21/13
to
Hello,

Do you mean to say that let say I have to execute below command through CGI C program then in that case I need to use -s option as well shown below. Please suggest. Thanks.

system("gtacl -c ’stop \$abc’");

would be

system("gtacl -s -c ’stop \$abc’");

Randall

unread,
Oct 21, 2013, 8:24:36 AM10/21/13
to
That is correct. However, it is only a suggestion not a requirement, but you are likely to need it.

Keith Dick

unread,
Oct 21, 2013, 9:52:28 AM10/21/13
to
Prashant wrote:
> On Monday, 21 October 2013 02:13:25 UTC+5:30, Keith wrote:
>
>>Prashant wrote:
>>
>>
>>>Hello All,
>>
>>>Can you please tell me that how I can call a "gtacl" routine on guardian from CGI program written in C on OSS enviornment.
>>
>>>Thanks in advance.
>>
>>>
>>
>>
>>
>>I imagine you are asking how to run a command from your CGI program that you can run using gtacl from an OSS prompt. If that is not what you were asking about, please try to explain further what you actually want to do.
>>
>>
>>
>>It seems that using the system() function would be the easiest way to do what you ask. Suppose the command you want to run from your CGI program was something that you could do from an OSS shell prompt by entering:
>>
>>
>>
>> gtacl -c ’stop \$abc’
>>
>>
>>
>>I believe you could do the same thing in your CGI program by calling the system() function like this:
>>
>>
>>
>> system("gtacl -c ’stop \$abc’");
>>
>>
>>
>>I have not used the system() function myself, so there might be some reason why this would not solve your problem. If I'm wrong, I hope someone else will answer and correct what I said here.
>>
>>
>>
>>If the gtacl command you want to run from your CGI program uses the -p option to run a Guardian program, you could do that by calling the Guardian procedures PROCESS_CREATE_ or PROCESS_LAUNCH_.. This would avoid starting a copy of the OSS shell, which would be slightly more efficient, but it would be quite a bit more complicated, since you have many more parameters to pass, and you must send the Guardian process you create a standard startup message sequence. It probably is not worth the extra complexity to use PROCESS_CREATE_ or PROCESS_LAUNCH_.
>
>
> Thanks Keith. I need to write a CGI program using C language. I have TACL routine written on guardian environment. So I have to call same TACL routine by passing few arguments in a CGI program using C language. I hope you got my point.
>
> Regarding, system() I will try with same and let you know if any issues. Thanks.

That is the scenario I thought you were asking about, but I was not completely sure of it. So you would want to use gtacl with -c, not -p.

Randall's suggestion to include -s may be helpful. The issue is that the Guardian startup sequence allows only 1024 characters for passing all of the environment variables and values. An OSS process often has a large number of environment variables -- sometimes enough to exceed that limit. When that happens, gtacl writes a warning message that says it was not able to send all of the environment variables to the Guardian process. The -s options tells gtacl not to send the environment variables, avoiding the possibility of getting that warning. If proper execution of the command sent via gtacl depends on an environment variable that did not get sent, that can cause a problem. If you need some environment variables to be available to the Guardian command, you could delete enough unneeded environment variables in your program before calling system() and not use the -s option.

I'm not completely sure what Randall means when he talks about quoting and shell variable expansion. If you understand his point, that is good, but if you do not understand it, it might be helpful to ask him to explain that point further. If the command you want to run via gtacl does not contain any characters that the shell uses in shell variable expansion or file name expansion, then the point he is making probably does not affect you.

Prashant

unread,
Oct 21, 2013, 10:49:24 AM10/21/13
to
Thanks a lot for your valuable time and suggestions.

Robert Hutchings

unread,
Oct 21, 2013, 2:07:24 PM10/21/13
to
Actually, I'm curious as to what is your ultimate goal here...? Yes, you probably could invoke gtacl as we've said, but what are you really trying to accomplish?

Prashant

unread,
Oct 22, 2013, 7:24:36 AM10/22/13
to
On Monday, 21 October 2013 23:37:24 UTC+5:30, Robert Hutchings wrote:
> Actually, I'm curious as to what is your ultimate goal here...? Yes, you probably could invoke gtacl as we've said, but what are you really trying to accomplish?

Hi,

I need to write a CGI program in C in which it will get a request from http. Request page will be in html which will pass values in post method. Same CGI program will receive the same and will pass user entered variable to TACL rotine as inputs/arguments then it same routine response will be take by CGI program i.e. .pway file and will display on web browser.

So I have a written a CGI program in C and compiled same. Now I have .pway object file with me.

Can you please tell me that how can start and stop the webserver? Looking for steps.

I have changed sampleservers.config file for my .pway so next step I need to stop and start the server. How I can do that? Please suggest. Thanks.


Keith Dick

unread,
Oct 22, 2013, 12:11:20 PM10/22/13
to
Do you not know how to find the manuals? Or are you trying to do this without looking at the manuals?

The manual titled "iTP Secure WebServer System Administrator's Guide" tells you nearly everything you need to know about the web server. In chapter 5, "Managing the iTP Secure WebServer Using Scripts", it tells you how to start and stop the web server:

cd /usr/tandem/webserver/conf
./start

or

cd /usr/tandem/webserver/conf
./stop

There also is a restart script in the same directory named restarth.

To get to the NonStop manuals:

1. Go to http://www.hp.com/go/nonstop-docs
2. Click on the link for your system type -- probably H-Series or J-Series.
3. In the search box at the very top of the page, enter keywords for what you are looking for.
In this case, the keyword webserver works (web server finds other things).
4. Click on the manual title and the .pdf file containing the whole document will open.
5. If you are going to be consulting the manual often, rather than clicking on the manual title,
right-click on the manual title and choose the option to save the target of the link to your
computer, then when you want to look at the manual, open your local copy. Go to the manuals
web site occasionally to check whether the manual has been updated since you took a copy.

Keith Dick

unread,
Oct 22, 2013, 12:14:29 PM10/22/13
to
The restart script named restarth picks up only some configuration changes. To do a full restart, use the script named restart.
Message has been deleted

Prashant

unread,
Oct 23, 2013, 1:59:14 AM10/23/13
to
On Wednesday, 23 October 2013 11:25:07 UTC+5:30, Prashant wrote:
> Hi Keith,
>
>
>
> I saw the manual. Looking towards manual I changed sample config file for start and stop and httpd config file as well. But it was not working properly. So I am working on it first time so i thought I am doing something wrong or missing something. So thoughts of confirming. Thanks for help.

wbreidbach

unread,
Oct 23, 2013, 3:38:52 AM10/23/13
to
The very first thing you have to do is running the install script. go to /usr/tandem/webserver and look for the newest directory named T8996.... (in case of the non-secure version, the secure version has a different number). In that directory you will find a setup file you have to run and follow the instructions. Maybe this has already be done.
Afterwards go to the directory where the webserver has been installed. Go to webserver/conf. Rename the sample file to httpd.config and change the contents: Specify the name of the Pathway monitor and the TCP/IP processes as a minimum. Afterwards run the .start script. Afterwards the whole thing should start.

Robert Hutchings

unread,
Oct 23, 2013, 11:38:30 AM10/23/13
to
I had a couple of thoughts, maybe helpful, maybe not :)

An option would be to run Apache/Apache2, if you are more familiar with that software stack. I imagine you could compile it from source on the OSS personality.

Also, there is a "Guardian Web server" that was written by an HP consultant in the mid 1990s. His name was Kari and you could Google "Kari web server". This way you could do everything in the Guardian space...

Robert Hutchings

unread,
Oct 23, 2013, 11:43:31 AM10/23/13
to

Randall

unread,
Oct 24, 2013, 2:55:05 PM10/24/13
to
On Wednesday, October 23, 2013 11:43:31 AM UTC-4, Robert Hutchings wrote:
> http://193.65.99.19/kku/tools.html

Might want to rename the thread, since this has gone down the webserver path.

Robert Hutchings

unread,
Oct 24, 2013, 6:49:07 PM10/24/13
to
Yes, if the OP wants to pursue the webserver route it should be renamed. Maybe he is satisfied with the system() call for gtacl?
0 new messages