Cannot successfully execute .sh: su - <name> -c


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cannot successfully execute .sh: su - <name> -c
# 1  
Old 10-18-2011
Cannot successfully execute .sh: su - <name> -c

Hi All,

First time poster, I hope I have the basics covered.

I am trying to execute a .sh but finding I am getting inconsistent results. A fresh set of eyes would be great.

I am using Solaris 10 zones.

So I am trying to execute a script but I am getting different results between environments/ zones.

Do you know what I can do to find out why? I don't notice any big differences..

In both Zone 1 and zone 2 I have this scheduled via cron (path has been changed):

40 23 * * * <path>/jbossStart.sh > /tmp/Jboss_start.log
10 23 * * * <path>/jbossStop.sh > /tmp/Jboss_stop.log

The file: <path>/jbossStop.sh, contains just this:
<path>/JBossServer1.sh stop


The log file contains different entries though between the environments??
/tmp/Jboss_stop.log


Zone 2:
Invoking su jbossuser -c <path>/JBossServer1.sh stop


Zone 1:
Shutdown message has been posted to the server.
Server shutdown may take a while - check logfiles for completion


Checking the logs, in Zone 2 jboss is not getting shutdown. Tha is the crux of my problem. I checked the environmental variables and cannot see much difference.

Interestingly, if I submit this from zone 1 and zone 2 these give consistent results:

Zone 1:
su - jbossuser -c ls
Password:

|-----------------------------------------------------------------|
| This system is for the use of authorized users only. |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their |
| activities on this system monitored and recorded by system |
| personnel. |
| |
| In the course of monitoring individuals improperly using this |
| system, or in the course of system maintenance, the activities |
| of authorized users may also be monitored. |
| |
| Anyone using this system expressly consents to such monitoring |
| and is advised that if such monitoring reveals possible |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials. |
|-----------------------------------------------------------------|

You have new mail.


zone 2:
su - jbossuser -c ls
Password:

|-----------------------------------------------------------------|
| This system is for the use of authorized users only. |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their |
| activities on this system monitored and recorded by system |
| personnel. |
| |
| In the course of monitoring individuals improperly using this |
| system, or in the course of system maintenance, the activities |
| of authorized users may also be monitored. |
| |
| Anyone using this system expressly consents to such monitoring |
| and is advised that if such monitoring reveals possible |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials. |
|-----------------------------------------------------------------|

You have new mail.

$ su - jbossuser -c ls
Password:

|-----------------------------------------------------------------|
| This system is for the use of authorized users only. |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their |
| activities on this system monitored and recorded by system |
| personnel. |
| |
| In the course of monitoring individuals improperly using this |
| system, or in the course of system maintenance, the activities |
| of authorized users may also be monitored. |
| |
| Anyone using this system expressly consents to such monitoring |
| and is advised that if such monitoring reveals possible |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials. |
|-----------------------------------------------------------------|

You have new mail.
$

I would have that thought the -c ls would work though..

I have not noticed a difference between zone 1 and zone 2 for the 'jbossuser' user. Attached are the results from the 'set' command for both environments for the user 'jbossuser'. I can show those if you like.

jbossuser has rwx permissionss on <path>/jbossStart.sh and on the parent directory in both zone 1 and zone 2. jbossuser is the owner and in the primary group as well.

Does anything jump out to you as to things to check?

cheers,
# 2  
Old 10-19-2011
Hi,

please change set of file permissions....and execuate, what ever it is zone and other things.........
# 3  
Old 10-19-2011
Thanks for the reply.

I do want to point out though that jbossuser has rwx permissionss on <path>/jbossStart.sh and on the parent directory in both zone 1 and zone 2. jbossuser is the owner and in the primary group as well.

So to make it more explicit:

zone1:
-rwxr-x--x 1 jbossuser jboss 5643 Sep 22 17:53 JBossServer1.sh

zone2:
-rwxrwxrwx 1 jbossuser jboss 4782 Aug 16 17:54 JBossServer1.sh

cheers,
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How-to verify if my package installed successfully

Can you please let me know how can i verify /check inside the script if the below to package installation commands are successful or if they failed for any reasons? 1. pkgadd -a $INSTP/install/dadmin -d $INSTP/install/apachesrv.pkg 2. pkgadd -a $INSTP/install/dadmin -d... (6 Replies)
Discussion started by: mohtashims
6 Replies

2. UNIX for Dummies Questions & Answers

Print script is completed successfully or not

Hai guys I am running three shellscripts through Gtk2-Perl(GUI) these are the scripts Drccalibrescript1 script2 script3 Gtk2-Perl(GUI) drccalibre -> If I run this script through Gtk2-Perl(GUI) these are results of the drccalibrescript1 . summary/.results I have to find size of... (1 Reply)
Discussion started by: kiran425
1 Replies

3. Shell Programming and Scripting

Did my script execute successfully ?

Hi, I have two scripts viz and I am running them in background. I wish to know if both the scripts completed execution successfully. So this is what I have done /tmp/commet/bin/connectdb1.sh & condb1=$? /tmp/commet/bin/connectdb2.sh & condb2=$? However, I am getting error... (7 Replies)
Discussion started by: mohtashims
7 Replies

4. Shell Programming and Scripting

script has been executed successfully or not??

Guys, How can we know whether a script has been executed successfully or not ? We dont have any log directories, and we are not given a chance to modify the script. Could someone help me out with this Thanks (2 Replies)
Discussion started by: bobby1015
2 Replies

5. UNIX for Advanced & Expert Users

Script working successfully only when executed twice

Guys, i am facing a very strange issue, my code below does an ftp to server A and gets a file to Server B, once the file is in B an if condition is present to check if the pattern of the filename is ABC* then it has to be encrypted using OPENSSL as ABC.enc else if it of pattern 123* has to be... (3 Replies)
Discussion started by: meva
3 Replies

6. AIX

Alert on successfully logins

Hi, How difficult would it be to configure an alert on AIX that will inform me every time someone logs into the system? (1 Reply)
Discussion started by: bbbngowc
1 Replies

7. Shell Programming and Scripting

Programs not compiling successfully

Preface: this is not a homework question. However, my teacher gave us a review packet with some C coding, and for some reason none of the C programs are compiling. First I compiled them from the shell, then I used a compiler to see if something was wrong with compiling from a shell. Both produced... (1 Reply)
Discussion started by: lazypeterson
1 Replies

8. UNIX for Dummies Questions & Answers

Mail delivered successfully?

Hi Is there any way I can know whether my mail has been delivered successfully or not....? I am using a shellscript which configures the header and the message body and also includes configurations for attachments. I use 'sendmail' to send the mails.... I have to resend the failed emails after... (7 Replies)
Discussion started by: Amruta Pitkar
7 Replies

9. UNIX for Dummies Questions & Answers

Successfully Installed Solaris 8 after all.

Hello There, Aftar all i successfully installed Solaris 8 on my Primary Slave 2nd Hard disk. Here what i did. I kept my first hard disk (Windows Me) on primary Master and put my new 2nd hard disk on Primary Slave, CDROM is on Secondary slave. When i install solaris8 it ask me two... (0 Replies)
Discussion started by: abidmalik
0 Replies
Login or Register to Ask a Question