The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
inetd process binums HP-UX 4 06-01-2006 01:59 PM
how to convert from korn shell to normal shell with this code? forevercalz Shell Programming and Scripting 21 11-23-2005 02:18 AM
How to process multiple files in Korn Shell stevefox Shell Programming and Scripting 3 11-22-2005 06:39 AM
checking for a running process from korn cron jph Shell Programming and Scripting 2 05-01-2005 01:27 AM
KORN Shell - Spawn new shell with commands frustrated1 Shell Programming and Scripting 2 04-20-2005 03:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-11-2007
vishi_82 vishi_82 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 5
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 (permalink)  
Old 06-11-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
The script should start as follows:

Code:
#!/bin/ksh
  #3 (permalink)  
Old 06-11-2007
vishi_82 vishi_82 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 5
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 (permalink)  
Old 06-11-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
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 (permalink)  
Old 06-11-2007
vishi_82 vishi_82 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 5
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 (permalink)  
Old 06-11-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0