Run a process through inetd using korn shell!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Run a process through inetd using korn shell!!!
# 1  
Old 06-11-2007
Run a process through inetd using korn shell!!!

Hi,

I am trying to run a process through inetd using ksh.

The entry in /etc/inetd.conf is
Process_Name tcp nowait root /home/user/script script

The script is as follows
/usr/bin/ksh -c /path/process

Recycling inetd services is successfully completed.
But when the process is accessed by any application, the log file shows the following error:
inetd[8555]: exec /home/user/script: Exec format error

When i execute the script from the command line, it executes successfully and the process is started.

Could someone please help me with this?
Also how can I confirm that the process is running in ksh?

Thanks in Advance!
Vishi
# 2  
Old 06-11-2007
The script should start as follows:

Code:
#!/bin/ksh

# 3  
Old 06-11-2007
Hi,

Thanks for the reply.
I tried out your suggestion.
Now there is no Exec format error.

But when any application accesses this service and runs an internal command, the log file says it tried to execute it in the bourne shell.

for eg;
An application accesses this process and runs a command jr %
the log file says
/bin/sh: jr: not found.

It will only run if it is executed in the korn shell.

Is there any way of confirming whether the said process is spawned using the korn shell or the bourne shell?

Any help would be appreciated.

Thanks in advance.
Vishi
# 4  
Old 06-11-2007
Is the script now saying....

Code:
#!/bin/ksh

/usr/bin/ksh -c /path/process

What is $SHELL set to as it is executing? Does your script /path/process also have #!/bin/ksh or similar at it's start?

Try switching running from /bin/sh in your terminal session, set SHELL to /bin/sh and then test your program.

What is your PATH set to in a terminal session and in the environment running inetd? Put "PATH=/usr/bin:/bin" near the start of your script and add paths as needed.
# 5  
Old 06-11-2007
Is the script now saying....
Code:
#!/bin/ksh
/usr/bin/ksh -c /path/process
Yes, thats what the script looks like now.


What is $SHELL set to as it is executing? Does your script /path/process also have #!/bin/ksh or similar at it's start?
/path/process is not a script, it is an executable and runs in the background when it is called through inetd.conf

Try switching running from /bin/sh in your terminal session, set SHELL to /bin/sh and then test your program.
When I run it from my command line, the process starts up, but according to the script "/usr/bin/ksh -c /path/process" it should be spawned in the korn shell.
How do i verify this?



Thanks.
Vishi
# 6  
Old 06-11-2007
If it's an executable (as in compiled code) it should not matter what shell started it.

I think also you need to provide the path to "jr" in the environment in the shell you start from inetd.conf.
# 7  
Old 06-11-2007
Hi,

Thanks a lot for your help.

Vishi
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to run a process through shell script.?

hey , i have to write a script to run a process through shell script and if the process runs successfully then return success. i used nohup to start the process but nothing occured . #!/bin/sh nohup ./cvt -f MediationSources.xml & can anyone pls help me Thanks (3 Replies)
Discussion started by: ramsavi
3 Replies

2. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

3. Shell Programming and Scripting

Help with shell script to run a converter process

Hi, I have about 500 binary files. I have a command to convert these files to text. The command usage is: converter bin-file txt-file I have to input the name of the binary file and the name of the text file. I'm thinking something like this will work, but not really sure: for file in... (1 Reply)
Discussion started by: bbbngowc
1 Replies

4. Shell Programming and Scripting

Generate array name at run time Korn shell

Hi, I am trying to define number of array based on constant derived during execution phase of a script. Here is what i am trying.. #First Part, Get LUN input from User lun_count=4 count=0 set -A my_lun while : do while ]; do read L?"Enter Lun "$count" Number:" ... (2 Replies)
Discussion started by: harris2107
2 Replies

5. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

6. HP-UX

inetd process

-------------------------------------------------------------------------------- Hi All , I have a client an server among which i want to make the server an inetd process. I have enries in etc/services and etc/inetd.conf The enries looks like below etc/services servername 5551/tcp... (4 Replies)
Discussion started by: binums
4 Replies

7. Shell Programming and Scripting

how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell.. #!/bin/ksh home=c:/..../ input=$1 sed '1,3d' $input > $1.out line="" cat $1.out | while read a do line="$line $a" done echo $line > $1 rm $1.out however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies

8. Shell Programming and Scripting

How to process multiple files in Korn Shell

How do I make the below ksh to process all of the files inside a user specified directory? Currently it can only process one file at a time. #!/bin/ksh tr -s '\11 ' ' ' < $1 > temp0 sed -e 's/,//g' temp0 > temp1 cut -d' ' -f1,4,5 temp1 > final_output rm temp0 temp1 (3 Replies)
Discussion started by: stevefox
3 Replies

9. Shell Programming and Scripting

checking for a running process from korn cron

cron starts a job every 10 minutes via a korn shell - I need to determine if the previous process is still running before I allow the new process to start - HELP I've tried ps -ef, etc but I have seen many situation where it says that the is running when it is not - any ideas on how to absolutely... (2 Replies)
Discussion started by: jph
2 Replies

10. UNIX for Dummies Questions & Answers

Run away "bootpgw" & "inetd"

Hello All. I'm get the following messages posted to the /var/adm/syslog file ever second and not sure on how to stop the process. May 14 15:50:52 a3360 bootpgw: version 2.3.5 May 14 15:50:52 a3360 inetd: /etc/bootpgw exit 0x1 As said about this gets logged every second only thing that... (4 Replies)
Discussion started by: cfaiman
4 Replies
Login or Register to Ask a Question