PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Remote Shell Execution Problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Remote Shell Execution Problem

Réponse
 
LinkBack Outils de la discussion
Vieux 21/04/2008, 16h53   #1
invincible
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Remote Shell Execution Problem

All,
Im trying to execute some commands on remote server thorugh script and
ssh.
When I run a normal command from prompt I do not get any error
messages but
when I run it thorugh script I get the execute permission denied
message.
Script is as below

#Checking the presence of tasks file
USR=abcd@
LISTSERVER="dubba libba"
OUTFILE=/home//testing/scriptoutput
#Create new file
>$OUTFILE

#Connect each server and pull up the listing
for host in $LISTSERVER
do
echo "------------------------------------------------" >>$OUTFILE
echo " * HOST : $host " >>$OUTFILE
ssh $USR$host "more /home/apps/conf/tasks.tbl|awk '{print \$1}'"
>>OUTFILE

done

The error enounterd is ...
../check_ps
/home/apps/conf/tasks.tbl: The file access permissions do not allow
the
specified action.
I can although run the command ssh USR$host "more
/home/apps/conf/tasks.tbl|awk '{print \$1}'" on the command prompt and
get
the desired result.
Hoping for some inputs.... __.____._
  Réponse avec citation
Vieux 21/04/2008, 17h18   #2
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Remote Shell Execution Problem

On Monday 21 April 2008 17:53, invincible wrote:

> #Checking the presence of tasks file
> USR=abcd@
> LISTSERVER="dubba libba"
> OUTFILE=/home//testing/scriptoutput


Why does this have two slashes between "home" and "testing"?

> #Create new file
>>$OUTFILE

> #Connect each server and pull up the listing
> for host in $LISTSERVER
> do
> echo "------------------------------------------------" >>$OUTFILE
> echo " * HOST : $host " >>$OUTFILE
> ssh $USR$host "more /home/apps/conf/tasks.tbl|awk '{print \$1}'"
>>>OUTFILE


That should be $OUTFILE. Also, what's the point of piping the output
of "more" to awk, rather than the file directly?

These probably won't solve your problem, but are worth correcting.

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
  Réponse avec citation
Vieux 21/04/2008, 18h17   #3
Glenn Jackman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Remote Shell Execution Problem

At 2008-04-21 11:53AM, "invincible" wrote:
> All,
> Im trying to execute some commands on remote server thorugh script and
> ssh.
> When I run a normal command from prompt I do not get any error
> messages but
> when I run it thorugh script I get the execute permission denied
> message.

[...]
> ssh $USR$host "more /home/apps/conf/tasks.tbl|awk '{print \$1}'"


Try replacing that with
ssh $USR$host env

and see if it's different between your command line and the script.


--
Glenn Jackman
"If there is anything the nonconformist hates worse than a conformist,
it's another nonconformist who doesn't conform to the prevailing
standard of nonconformity." -- Bill Vaughan
  Réponse avec citation
Vieux 21/04/2008, 19h16   #4
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Remote Shell Execution Problem



On 4/21/2008 10:53 AM, invincible wrote:
> All,
> Im trying to execute some commands on remote server thorugh script and
> ssh.
> When I run a normal command from prompt I do not get any error
> messages but
> when I run it thorugh script I get the execute permission denied
> message.
> Script is as below
>
> #Checking the presence of tasks file
> USR=abcd@
> LISTSERVER="dubba libba"
> OUTFILE=/home//testing/scriptoutput
> #Create new file
>
>>$OUTFILE

>
> #Connect each server and pull up the listing
> for host in $LISTSERVER
> do
> echo "------------------------------------------------" >>$OUTFILE
> echo " * HOST : $host " >>$OUTFILE
> ssh $USR$host "more /home/apps/conf/tasks.tbl|awk '{print \$1}'"
>
>>>OUTFILE

>>

> done
>
> The error enounterd is ...
> ./check_ps
> /home/apps/conf/tasks.tbl: The file access permissions do not allow
> the
> specified action.
> I can although run the command ssh USR$host "more
> /home/apps/conf/tasks.tbl|awk '{print \$1}'" on the command prompt and
> get
> the desired result.
> Hoping for some inputs.... __.____._


I don't think it's related to your problem, but Im curious: what do you think this:

more file | awk '...'

does better than:

awk '...' file

and why "more" rather than "cat"?

Regards,

Ed.

  Réponse avec citation
Vieux 22/04/2008, 09h40   #5
invincible
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Remote Shell Execution Problem

On Apr 21, 5:18 pm, pk <p...@pk.invalid> wrote:
> On Monday 21 April 2008 17:53, invincible wrote:
>
> > #Checking the presence of tasks file
> > USR=abcd@
> > LISTSERVER="dubba libba"
> > OUTFILE=/home//testing/scriptoutput

>
> Why does this have two slashes between "home" and "testing"?
>
> > #Create new file
> >>$OUTFILE

> > #Connect each server and pull up the listing
> > for host in $LISTSERVER
> > do
> > echo "------------------------------------------------" >>$OUTFILE
> > echo " * HOST : $host " >>$OUTFILE
> > ssh $USR$host "more /home/apps/conf/tasks.tbl|awk '{print \$1}'"
> >>>OUTFILE

>
> That should be $OUTFILE. Also, what's the point of piping the output
> of "more" to awk, rather than the file directly?
>
> These probably won't solve your problem, but are worth correcting.
>
> --
> All the commands are tested with bash and GNU tools, so they may use
> nonstandard features. I try to mention when something is nonstandard (if
> I'm aware of that), but I may miss something. Corrections are welcome.


Thanx all, the problem has been solved out with the of good
memebers of this forum.

It seems it was all the small problem you all had listed out which was
creating the issue.
  Réponse avec citation
Vieux 22/04/2008, 09h40   #6
invincible
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Remote Shell Execution Problem

On Apr 21, 7:16 pm, Ed Morton <mor...@lsupcaemnt.com> wrote:
> On 4/21/2008 10:53 AM, invincible wrote:
>
>
>
> > All,
> > Im trying to execute some commands on remote server thorugh script and
> > ssh.
> > When I run a normal command from prompt I do not get any error
> > messages but
> > when I run it thorugh script I get the execute permission denied
> > message.
> > Script is as below

>
> > #Checking the presence of tasks file
> > USR=abcd@
> > LISTSERVER="dubba libba"
> > OUTFILE=/home//testing/scriptoutput
> > #Create new file

>
> >>$OUTFILE

>
> > #Connect each server and pull up the listing
> > for host in $LISTSERVER
> > do
> > echo "------------------------------------------------" >>$OUTFILE
> > echo " * HOST : $host " >>$OUTFILE
> > ssh $USR$host "more /home/apps/conf/tasks.tbl|awk '{print \$1}'"

>
> >>>OUTFILE

>
> > done

>
> > The error enounterd is ...
> > ./check_ps
> > /home/apps/conf/tasks.tbl: The file access permissions do not allow
> > the
> > specified action.
> > I can although run the command ssh USR$host "more
> > /home/apps/conf/tasks.tbl|awk '{print \$1}'" on the command prompt and
> > get
> > the desired result.
> > Hoping for some inputs.... __.____._

>
> I don't think it's related to your problem, but Im curious: what do you think this:
>
> more file | awk '...'
>
> does better than:
>
> awk '...' file
>
> and why "more" rather than "cat"?
>
> Regards,
>
> Ed


I had some issues with cat initialliay , but I have now replaced the
cat. and it seems to solve the issue out.
  Réponse avec citation
Vieux 22/04/2008, 12h52   #7
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Remote Shell Execution Problem



On 4/22/2008 3:40 AM, invincible wrote:
> On Apr 21, 7:16 pm, Ed Morton <mor...@lsupcaemnt.com> wrote:
>
>>On 4/21/2008 10:53 AM, invincible wrote:
>>
>>
>>
>>
>>>All,
>>>Im trying to execute some commands on remote server thorugh script and
>>>ssh.
>>>When I run a normal command from prompt I do not get any error
>>>messages but
>>>when I run it thorugh script I get the execute permission denied
>>>message.
>>>Script is as below

>>
>>>#Checking the presence of tasks file
>>>USR=abcd@
>>>LISTSERVER="dubba libba"
>>>OUTFILE=/home//testing/scriptoutput
>>>#Create new file

>>
>>>>$OUTFILE
>>>
>>>#Connect each server and pull up the listing
>>>for host in $LISTSERVER
>>>do
>>>echo "------------------------------------------------" >>$OUTFILE
>>>echo " * HOST : $host " >>$OUTFILE
>>>ssh $USR$host "more /home/apps/conf/tasks.tbl|awk '{print \$1}'"

>>
>>>>>OUTFILE
>>>>
>>>done

>>
>>>The error enounterd is ...
>>>./check_ps
>>>/home/apps/conf/tasks.tbl: The file access permissions do not allow
>>>the
>>>specified action.
>>>I can although run the command ssh USR$host "more
>>>/home/apps/conf/tasks.tbl|awk '{print \$1}'" on the command prompt and
>>>get
>>>the desired result.
>>>Hoping for some inputs.... __.____._

>>
>>I don't think it's related to your problem, but Im curious: what do you think this:
>>
>> more file | awk '...'
>>
>>does better than:
>>
>> awk '...' file
>>
>>and why "more" rather than "cat"?
>>
>>Regards,
>>
>> Ed

>
>
> I had some issues with cat initialliay , but I have now replaced the
> cat. and it seems to solve the issue out.


OK, but hopefully you realise you don't need "cat" at all in this example and by
"replaced" you actually mean "removed"...

Ed.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h37.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16271 seconds with 15 queries