Solved

running scripts remotely

Posted on 2000-05-03
10
255 Views
Last Modified: 2010-04-21
Hello,

I am try to run a job from one unix box and have it run on another without manually typing in any information? That way I can submit a job in the scheduler and it will connect and excute the script on an other unix box.
0
Comment
Question by:rp15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 1

Expert Comment

by:meerak
ID: 2775499
Which OS are u using?

From  solaris:
rsh <machine name> -l <username> <script name>
From hp
remsh <machine name> -l <username> <script name>

You need to have the .rhosts file properly set for these commands to
work properly.

For eg. If you allow machine1 with user user1 to access your machine,
then have the following line in ~/.rhosts

machine1 user1.
0
 

Expert Comment

by:bsher
ID: 2776049
using rsh and put into cron.
crontab -u username -e
0
 

Author Comment

by:rp15
ID: 2789702
I believe using crontab means that you are setting up a certain time when these jobs are going to be run. I have never actually used so please let me know if that is a correct statement.  If it is then in my case that would not help me.  To give you an example of how me scheduler works.  I will kick off the schedule manually to begin with and then jobs will run once the jobs they are dependent on have finished. Also I need to be able to send a password since my passwords are different on each machine.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:rp15
ID: 2789724
The OS want to send the command from is AIX version 4.  The operating system for the the unix box I want to run the script on is SMP_DC_OSx.  One of my problems that I am encountering is that I can not send my password over to the second machine.  Which is important since my passwords are different.  Also, is there a way to send a password by using the .rhost file?
0
 
LVL 2

Expert Comment

by:GP1628
ID: 2789733
rsh is not suggested for reasons of security. You might look at ssh (secure shell) instead.

Actually just about any method of doing this is going to be considered insecure. Is the script a changing one or will the jobs on the receiving system always be the same? Did you just need a way to signal those machines to run their scripts?

Gandalf  Parker
0
 
LVL 1

Expert Comment

by:meerak
ID: 2790053
You need not give passwords in you ~/.rhosts file.

For eg. If you have an username "usr1" in a machine1 and
"usr2" on machine2.

In the file /home/usr1/.rhosts (Assuming this is your home directory)
of the machine1 have the following entry.

machine2 usr2

Assuming from machine2 you execute script on machine1:

machine2> rsh machine1 -l usr1 <command name or script>

It should work without any problem.
0
 

Expert Comment

by:CASIOFL
ID: 2793641
rp15, I'm not too familiar with AIX, but I believe AIX is system V unix flavor like Solaris 2.x.  Although not recommended for security reasons, and I'm assuming that the loginID's home directory is the same and is nfs mounted to all the machines in question.  Just create a .rhosts file in the LoginId's home directory with the following entry in it:
   + loginID

replace the loginID with the your loginID. This should give trusted access to execute any commnads to available to that loginID without any system asking you for a passwd. Note that executable commands only available to root will still not available to the loginID.

As to the script, as long as you do not execute in the background the script will wait for the previous command to finish before continuing with normal execution.

Hope this helps..
0
 

Expert Comment

by:troyrock
ID: 2800518
I would suggest using a scripting language on your AIX machine.  A language like 'expect' would be able to do everything that you would do while sitting there - wait for the 'login:' or 'password:' prompt and "type" the appropriate thing in.  There is a huge security problem here because the script that you feed expect would have to have your password in it so you could try to protect it by setting the permision of the file to r------- but your system administrator (root) would still be able to read it and then get access to your remote machine (but then again maybe this isn't a concern or maybe you are root).
0
 
LVL 2

Expert Comment

by:GP1628
ID: 2800685
still no answer to my questions so here is alittle of where I was headed.
A much more secure way is to have scripts running in the background of all the machines watching for a signal to run the script.

If the script is the same every time then they can even just watch for a certain login from a certain machine. If it is the same but needs a few bits of info then the script ca be watching for a small file to appear which has the variables, use the file for input on the script, then delete the file, continue watching.

There are other features of this which can be discussed but the gist of it is that a very low-permission restricted login can be used to signal a very high permission (even root) kickof of a script.

Gandalf  Parker
0
 
LVL 2

Accepted Solution

by:
ish earned 100 total points
ID: 2842135
I wouldn't recomend this to anyone...  almost any "remote running" of scripts is a security flaw...

2 possible answers:

#1: using the rsh to get to server2 from server1 have the .cshrc run a command on login that starts your proccess.....

#2: NFS/crontab trick (I use this one, so I know it works).  Set your crons or at (or what ever scheduler you use) to run when needed (possibly kicked by the rsh?)  and have it look to an NFS mounted partition for the prescence of DATA.FILE on /export/DATA (or whatever you want to call it).

have /export/DATA be an NFS mounted partition from server1 -> server2.
   if file exists then input and run; rm file
   if file does not exsist then mail status and terminate.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question