Sponsored Content
Full Discussion: ksh behavior change on RHEL5
Top Forums Shell Programming and Scripting ksh behavior change on RHEL5 Post 302416759 by ygemici on Tuesday 27th of April 2010 04:20:05 PM
Old 04-27-2010
MySQL

Quote:
Originally Posted by bwhitehd
The cron was not running at the same time. I was done afterwards. The value expected from cron is 2 because cron spawns the script using Bourne shell (sh) as seen from the output.

infa 3962 3961 0 12:32 ? 00:00:00 /bin/sh -c /app2/stage/aim/aim_ap_etl/test.ksh > /app2/stage/aim/aim_ap_etl/test.out 2>&1
infa 3963 3962 0 12:32 ? 00:00:00 /bin/ksh /app2/stage/aim/aim_ap_etl/test.ksh

The primary issue that I'm dealing with is that the developers who created a script that runs on these hosts are producing different output since the patching. As you can see, the patched system is assigning the value of 3 when it should be 2 to the proc variables when run via cron.
I dont think a cron related problem..Also manuel outputs is giving same result that add one more to variables on patched systems..
Maybe when your ps value send to variable kernel show another process that named called script..

Maybe
Code:
root     14760 14747  0 06:43 pts/1    00:00:00 [script]

And you try probably `ps aux` for clear result..

Or you must put same lines after variables again in your code
Again lets see output Smilie


Code:
 
/bin/ps -ef | /bin/grep -v grep | /bin/grep $SCRIPT | /usr/bin/wc -l

echo "-----------"
 
/bin/ps -ef | /bin/grep -v grep | /bin/grep $SCRIPT
proc1=`ps -ef | /bin/grep -v grep | /bin/grep -c $SCRIPT`
echo "proc1=$proc1"
 
/bin/ps -ef | /bin/grep -v grep | /bin/grep -c $SCRIPT
proc2=$( (ps -ef | /bin/grep -v grep | /bin/grep -c $SCRIPT) )
echo "proc2=$proc2"
 
/usr/bin/pgrep $SCRIPT | /usr/bin/wc -l
proc3=$(/usr/bin/pgrep $SCRIPT | /usr/bin/wc -l)
echo "proc3=$proc3"

/bin/ps -ef | /bin/grep -v grep | /bin/grep $SCRIPT | /usr/bin/wc -l

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh parameter --- change

I am reading a file into a parameter in my program typeset nums_type if the contents of nums_type = asdfghbqwerty how do make a new paremeter eqaul to the 7th character of nums_type. like ${type} = b (2 Replies)
Discussion started by: frank
2 Replies

2. Shell Programming and Scripting

Strange behavior from 'read' statements. (ksh - but could be same on other shells)

I'm getting rather frustrated with an interactive script I'm writing. The script is divided up, with section for setting variable at the top, then functions (which make up most of the script) then basically a line at the end which calls the first function- the program moves between the... (5 Replies)
Discussion started by: alexop
5 Replies

3. UNIX for Dummies Questions & Answers

Change to ksh shell

Hi everyone: Mi default shell is sh, i need to set the TMOUT variable so i need to change the shell to ksh, I change the /etc/profile file as follows, but when i do an echo $0 stll sh been the shell: # more /etc/profile # # (c) Copyright 1990, OPEN SOFTWARE FOUNDATION, INC. # ALL RIGHTS... (2 Replies)
Discussion started by: irasela
2 Replies

4. UNIX for Dummies Questions & Answers

How can I change the behavior of the mouse in Terminal?

Hi, I hope I'm posting in the correct forum, so here goes. I would like for the mouse right/left click to work in Terminal (OSX) as it does in Putty. For instance, when I double click 'log' in file.log.gz, only the log part is highlighted (in Terminal), while in Putty the entire file name is... (0 Replies)
Discussion started by: TheChemist
0 Replies

5. UNIX for Advanced & Expert Users

How to change the permissions of ksh?

Suppose, I want to execute unix commands. For that I have to go to ksh, but if I don't have execute permission to ksh itself then is there any way to change the permission of ksh? chmod command does not work for this because, I don't have permission to ksh itself... :) Let me know, if you have... (3 Replies)
Discussion started by: ponnuvel
3 Replies

6. Shell Programming and Scripting

ksh script to change passwd

Hello All, I am trying to change a user passwd (one time password): cat /tmp/passwd mnop1234 mnop1234 #passwd abcd < /tmp/passwd (for some reason, it is not able to input the password from /tmp/passwd and comes back with "New Password: ") Is there a work around except using "expect". ... (1 Reply)
Discussion started by: solaix14
1 Replies

7. Shell Programming and Scripting

change output format using ksh

I have a script that reaches out to several systems and pulls back infomation in serveral files. I would like to take the infomation returned and reformat it so I can export it to excel. Below is current output: File1:item1:abc=1 File1:item2:efg File2:item1:ab=1 File2:item2:efg... (3 Replies)
Discussion started by: oldman2
3 Replies

8. Shell Programming and Scripting

ksh behavior in scripts spawned w/nohup

I have a need to run any number of identical scripts simultaneously, so I've created a driver script which reads a template script, edits these appropriately and then submits them via nohup. The spawned scripts all check to see at some point how many of their number are running and once the count... (7 Replies)
Discussion started by: safedba
7 Replies
suspend(1)                                                         User Commands                                                        suspend(1)

NAME
suspend - shell built-in function to halt the current shell SYNOPSIS
sh suspend csh suspend ksh suspend DESCRIPTION
sh Stops the execution of the current shell (but not if it is the login shell). csh Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su. ksh Stops the execution of the current shell (but not if it is the login shell). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5) SunOS 5.10 15 Apr 1994 suspend(1)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy