The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Executing a script through GUI snvijaysankar UNIX for Dummies Questions & Answers 2 06-02-2008 01:49 AM
Remotely executing awk command bishweshwar Shell Programming and Scripting 1 07-14-2007 02:20 PM
How to remotely execute a script (.COM ) on a VMS system ? ivancleber Shell Programming and Scripting 1 07-27-2006 05:44 AM
How to remotely execute a script (.COM ) on a VMS system ? ivancleber UNIX for Advanced & Expert Users 1 07-26-2006 12:01 PM
How to remotely execute a script on a VMS system ? ivancleber AIX 0 07-26-2006 10:14 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-20-2007
Registered User
 

Join Date: Dec 2006
Posts: 28
Executing remotely the script

Hi All,

I have a script to be executed in another machine. I connect to that machine from another server as a root ( this is the only configured access, as i cannot log in as a normal user). After that I have to switch to a normal user and that I can be able to executge that script. But all this is done manually, that why Im interested in finding a way to automate the execution and not typing always:

remsh machine_name
su - sc
./script.sh

Please could anyone help me
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-20-2007
Registered User
 

Join Date: Jan 2007
Posts: 366
Quote:
Originally Posted by elthox
Hi All,

I have a script to be executed in another machine. I connect to that machine from another server as a root ( this is the only configured access, as i cannot log in as a normal user). After that I have to switch to a normal user and that I can be able to executge that script. But all this is done manually, that why Im interested in finding a way to automate the execution and not typing always:

remsh machine_name
su - sc
./script.sh

Please could anyone help me
Code:
remsh machine_name "su - sc -c \"./script.sh\""
Reply With Quote
  #3 (permalink)  
Old 02-20-2007
Registered User
 

Join Date: Dec 2006
Posts: 28
Thanks for your reply
I tried what you wrote but it didnt succeed. Here is the output

vasstat1:/tmp/vms1# remsh smsc1 "su - sc -c \"./kot\""
ttytype: couldn't open /dev/tty for reading
You have mail.
stty: : Unknown error
Not a terminal
stty: : Unknown error
stty: : Unknown error
su: ./kot: not found.
Reply With Quote
  #4 (permalink)  
Old 02-20-2007
Registered User
 

Join Date: Jan 2007
Posts: 366
Quote:
Originally Posted by elthox
Thanks for your reply
I tried what you wrote but it didnt succeed. Here is the output

vasstat1:/tmp/vms1# remsh smsc1 "su - sc -c \"./kot\""
ttytype: couldn't open /dev/tty for reading
You have mail.
stty: : Unknown error
Not a terminal
stty: : Unknown error
stty: : Unknown error
su: ./kot: not found.
Does the script "kot" run as a cron job or does it request input?

The last error can be solved easy:
su: ./kot: not found.

remsh smsc1 "su - sc -c \"<full path to location of kot>/kot\""
Reply With Quote
  #5 (permalink)  
Old 02-20-2007
Registered User
 

Join Date: Dec 2006
Posts: 28
It is OK now, I run it successfully. Just one more question. How can I transmitt one or two parameter with the script

E.g remsh smsc1 "su - sc -c \"./kot.sh 2007-01 06845444\""

Is it correct like this?
Reply With Quote
  #6 (permalink)  
Old 02-20-2007
Registered User
 

Join Date: Jan 2007
Posts: 366
Quote:
Originally Posted by elthox
It is OK now, I run it successfully. Just one more question. How can I transmitt one or two parameter with the script

E.g remsh smsc1 "su - sc -c \"./kot.sh 2007-01 06845444\""

Is it correct like this?
Looks fine to me
Reply With Quote
  #7 (permalink)  
Old 02-21-2007
Registered User
 

Join Date: Dec 2006
Posts: 28
Hi again,

The output of the script above is supposed to be returned to the calling place.
I use rcp like below

rcp -p /var/opt/nokia/smsc/logdata/billfiles/out 172.20.1.25:/opt/output/daily_stats/config

I cannot understand why sometimes works and sometimes no, like today. It gives me this error
remshd: Login incorrect

Any clue?
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0