remote execution

Hi everybody,
sorry if the question will be too trivial for some of you, but I'm not a unix shell programmer expert.
I need to write a script that allows me to rlogin to another machine, check the load (cpu and mem usage) of the new machine, start a process (that will run in the background) and logout.
If I try:

rlogin new-machine
cd path/
...

after the rlogin, it will execute the 'cd' command locally instead of remotely. How can I make the script to execute the commands after the rlogin remotely?
How can I check the machine load?

Please let me know if my approach is completely wrong.

Many thanks in advance,
Carmelo

rsh or remsh may work better for you. Check out the man pages. From your description, a cron job may even work for you. The cron job would check the load and start the process.

I don't know which specific load information you are looking for but uname -a or sar may give you what you want.

You can use uptime to find out system load. Also if you want to determine the load based on the current CPU usage you may try

sar -u 1 1|/usr/xpg4/bin/grep -E ':'|grep -v usr|awk '{print $2+$3}'

Thus will print the sum of user and kernel % CPU usage

Hi,
thanks for your reply. I've used the 'rsh' command without problem. Regarding the 'sar' command, I don't have it. I had a look on the web and after I found it, I couldn't complete the installation because it complained about root permissions which I don't have. Is there any other way to install it? Or is it possible to use something else? What about uptime? I don't understand the values of load average in terms of what they are expressed. I just need the percentage of CPU usage, which it doesn't seem to give.

Thanks,
Carmelo

Sorry I forgot to say, if can be useful, that I'm using a Linux box with red-hat 7.3.

Thanks
Carmelo

Try man uptime
the system load averages for the past 1, 5, and 15 minutes.

Also you can get the %CPu usage using top, iostat and ps also.