AIX Shell script does not work


 
Thread Tools Search this Thread
Operating Systems AIX AIX Shell script does not work
# 1  
Old 07-27-2011
AIX Shell script does not work

Hi.

I created schell script for sending messages to some processes in AIX:

Code:
#!/bin/sh

BSE=/infor/ERPLN/bse
BSE_TMP=/infor/ERPLN/bse/tmp
export BSE BSE_TMP

for i in `ps -eo pid,comm | grep bshell | cut -f 1 -d " "`
do
/something $i
done

Unfortunatelly this script does not work on one AIX server. I don't know why. The same script works fine on another AIX servers. I tested simmilar script:

Code:
#!/bin/sh

BSE=/infor/ERPLN/bse
BSE_TMP=/infor/ERPLN/bse/tmp
export BSE BSE_TMP

for i in `ps -eo pid,comm | grep bshell | cut -f 1 -d " "`
do
echo $i
done

and this script works fine. I run all commands from script "by hand" and everything is fine.

Any idea why script does not work?

Thanks in advance.

Last edited by radoulov; 07-27-2011 at 09:19 AM.. Reason: Code tags, please!
# 2  
Old 07-27-2011
Unfortunately it seems to be something to do with the
Code:
/something $i

bit as $i is available in the loop as evidenced by your test.
# 3  
Old 07-27-2011
It should be OK. For every bshell process script has to send message:

/send_message PID1
/send_message PID2
/send_message PID3

....

Regards.
# 4  
Old 07-27-2011
And manual calls to send_message work as expected?

Is there anything we should know about the send_message command (does it spark up a thread in the background and return?)
# 5  
Old 07-27-2011
And manual calls to send_message work as expected? Yes.
Is there anything we should know about the send_message command (does it spark up a thread in the background and return?) No.
# 6  
Old 07-28-2011
Can you try and run the script in debug mode

just inlcude set -x in the script begining
# 7  
Old 07-29-2011
I already did it. Everything looks fine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Shell script - if statements dont work

hi all, i have made a shell script and it runs until it reaches the if statement, doesn't the ! mean only if the command fails it will echo me that message and then exit can anyone please help me what is wrong with my code? many thanks, rob #!/bin/bash echo "is this archive... (10 Replies)
Discussion started by: robertkwild
10 Replies

2. HP-UX

Su to another user from root doesn't work within shell script

Hello I have a shell script that is run as root. Script rins ok until the point where it have to switch to user "mqm" to run other commands. It just hangs at the point of this line in the script su - mqm -c "dspmq" I ran the same commands at the terminal and they run fine. Any thoughts. (6 Replies)
Discussion started by: mo12
6 Replies

3. Shell Programming and Scripting

Shell script to work on dates

Hi Sir/Madam I have a file data.txt like below file_name date_of_creation x 2/10/2012 y 8/11/2010 z 11/3/2013 a 2/10/2013 b 3/10/2013 c ... (4 Replies)
Discussion started by: kumar85shiv
4 Replies

4. UNIX for Dummies Questions & Answers

How to work command 'cd' in shell script?

I have simple script. like that, I am working on /usr/local/src and also under src folder there is a ft folder #!/bin/ksh #!/bin/bash dirpath="/usr/local/src/ft" echo $dirpath cd $dirpath echo displays ok "/usr/local/src/ft" but that doesn't enter "ft" folder. stays in current... (4 Replies)
Discussion started by: F@NTOM
4 Replies

5. Shell Programming and Scripting

$RANDOM does not work inside a shell script

Hi folks I'm coding on Ubuntu 9.04 standard shell. I'm writing a script that needs to generate a random number at some point of its execution. When I do echo $RANDOMas a command inside shell, I clearly get some randomly generated number However when I do i=`$RANDOM` echo $ior even... (14 Replies)
Discussion started by: ksk
14 Replies

6. Shell Programming and Scripting

SSH shell script does not work

Hello I have a Zabbix Server were Linux kernel version 2.6.26-2-amd64 is running. now my Question how can i make a script that does: - connect with ssh to a device - get the systeminfo (but only the interfaces, mac adresses, serialnumber and Software version) - write the output in a file ... (18 Replies)
Discussion started by: Fraggy
18 Replies

7. Shell Programming and Scripting

I need to do a work to my job, but i m new in script shell, someone can help with this..

I need to do a work to my job, but i m new in script shell, someone can help with this.. :confused: Description Bsafe The command creates a backup directory of each month at the command line (arguments of the script). The names of directories to copy will always be specified for the... (4 Replies)
Discussion started by: strshel
4 Replies

8. Shell Programming and Scripting

shell script does not work if run in background

Dear All, I am trying to run a script in background like ./scriptname.sh & but when i try to run it in background it is giving me an error "syntax error at line 12: `(' unexpected" at the line 12, there is a function definition "function getFileList()". This script runs fine if i run on... (2 Replies)
Discussion started by: bilalghazi
2 Replies

9. Shell Programming and Scripting

shell script, echo doesn't work

#!/bin/sh something(){ echo "Inside something" echo $1 $2 } val=$(something "Hello " "world") Output expected: Inside somethingHello world But it's not echoing. (4 Replies)
Discussion started by: cola
4 Replies

10. Shell Programming and Scripting

Global alias does not work in shell script

Hi Linux Set up - alias ls='ls -l' Then run script #! /bin/ksh sub() { ls } sub Is there any way to get it working. I don't want to define alias inside of the program Thank you (2 Replies)
Discussion started by: zam
2 Replies
Login or Register to Ask a Question