![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Inappropriate ioctl for device at | contactme | UNIX for Dummies Questions & Answers | 0 | 03-26-2007 07:22 AM |
| Inappropriate ioctl for device, format error | spoonman | SUN Solaris | 2 | 08-24-2006 09:01 AM |
| Inappropriate ioctl for device | steelrose | UNIX for Dummies Questions & Answers | 4 | 08-23-2006 07:08 AM |
| Inappropriate ioctl for device | spoonman | UNIX for Dummies Questions & Answers | 0 | 08-23-2006 06:39 AM |
| Inappropriate ioctl for device | tojaiganesh | Filesystems, Disks and Memory | 4 | 03-17-2005 02:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Dear all,
Problem goes like this: I have a shell script which when run manually runs perfectly. When same script is executed through a job schdeduler I get an error as Inappropriate ioctl for device and the script fails. This problems seems quite guiling to me. Any clues are heartly welcomed. Thanks Rishi |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
does your script have any "read" statements? is there any reason why the script's stdin or stdout would need to be connected to a terminal?
|
|
#3
|
||||
|
||||
|
My script is not at all interactive and does not read from stdin.
yeah it do write to some /tmp directory while sorting the data. And to my understanding this happens just when it tries to write to this mount. Thanks for helping framing the problem more clear. hope this will help everyone to figure out the reason why it does happen? Thanks Rishi |
|
#4
|
||||
|
||||
|
You are doing something in your script directly or indirectly that does indeed require a tty, but it is not a read nor a write. Put some echo statement in your script "echo at point 1", "echo at point 2", etc until you see the statement that fails.
|
|
#5
|
||||
|
||||
|
Quote:
As the code exists in production and we cannot change code without lots of approvals. Will like to elaborate the problem more clearly see if you can help. We have a script say run_job.ksh which is executed from a scheduler. This scripts calls a C executable, which itself invokes sort command. The snippet of the code calling sort command is like this: Code:
sprintf(tmpSortFileName, "/tmp/temp%s", "tempIRBPAVAInputFile");
/* Sort by carrier ID, company #, bill to RAO, statement date, BTN, ??? */
sprintf(sortcmd,
"sort -k 1.132,1.135 -k 1.118,1.119 -k 1.118,1.119 "\
"-k 1.112,1.114 -k 1.104,1.111 -k 1.142,1.151 "\
"-k 1.155,1.162 %s > %s", inputFileName, tmpSortFileName);
system(sortcmd);
if(errno)
{
fprintf(stderr,
"Error sorting the input file %s...\nExiting...\n",
inputFileName);
exit(ERR);
}
This is the sequence of error I receive in scheduler logs: : Inappropriate ioctl for device Error sorting the input file /tmp/tempIRBPAVAInputFile... Exiting... Any help will be highly appreciated. |
|
#6
|
||||
|
||||
|
That piece of c code is not the problem. Did you surround the this program with echo statements to be sure that it is causing the problem? If so, look further in the program for some tty specific operation.
|
|
#7
|
||||
|
||||
|
yes, as I told I am not in position to add echo statments but there do exists a echo statment and data echoed is perfectly visible in log.
After tht echo call only the C executable is invoker with appropiate arguments. Why i am worried with this pieve of code specifically is we have two functioncalls sortTempInputFile and sortInputFile. First call "sortInputFile" is always successfull while second call where only filename is different fails "sortTempInputFile" before invoking the sort command we even check the error code. complete code of function is: Code:
void sortTempInputFile(char *inputFileName)
{
char sortcmd [1024] = "\0";
char tmpSortFileName [1024] = "\0";
iFileName[0] = '\0';
if(errno)
{
perror(" ");
}
sprintf(tmpSortFileName, "/tmp/temp%s", "tempIRBPAVAInputFile");
/* Sort by carrier ID, company #, bill to RAO, statement date, BTN, ??? */
sprintf(sortcmd,
"sort -k 1.132,1.135 -k 1.118,1.119 -k 1.118,1.119 "\
"-k 1.112,1.114 -k 1.104,1.111 -k 1.142,1.151 "\
"-k 1.155,1.162 %s > %s", inputFileName, tmpSortFileName);
system(sortcmd);
if(errno)
{
fprintf(stderr,
"Error sorting the input file %s...\nExiting...\n",
inputFileName);
exit(ERR);
}
sprintf(sortcmd, "chmod 777 %s", tmpSortFileName);
system(sortcmd);
if(errno)
{
fprintf(stderr,"%s%s\n",
"Error changing permissions for the temp input file ...",
"Exiting...");
exit(ERR);
}
sprintf(sortcmd, "mv -f %s %s", tmpSortFileName, inputFileName);
system(sortcmd);
if(errno)
{
fprintf(stderr,"Error moving the input file ...\nExiting...\n");
exit(ERR);
}
}
|
||||
| Google The UNIX and Linux Forums |
| Tags |
| inappropriate ioctl for device |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|