![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help Required: Command to find IP address and command executed of a user | loggedout | Security | 2 | 08-06-2008 05:12 PM |
| how to? launch command with string of command line options | TinCanFury | Shell Programming and Scripting | 5 | 04-28-2008 03:06 PM |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | Linux | 5 | 07-30-2007 05:26 AM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | HP-UX | 1 | 10-16-2006 01:16 PM |
| How to use more than one MPE command STREAM with Unix command in a single shell? | bosskr | Shell Programming and Scripting | 0 | 09-19-2006 06:44 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
rsh command
we want to execute remote script via rsh (we just only should use rsh except others),but rsh command can not set environment variable for specify user, then scripts can not be executed correctly,anyone knows how to fix this problem? thanks.
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Put the environment variable assignment in the command to execute...
Code:
rsh remote-host "FOO=bar do-thing" |
|
#3
|
|||
|
|||
|
Because the command required many environment variables which are defined in the specify user's profile:.bash_profile, we create a executed scripts.First in scripts, we want to execute .bash_profile to set evnironment, secondly, to run the program. The scripts looks like the following
Code:
#!/sbin/sh
. .bash_profile or . .profile # set the environment variable
...
do-something
Last edited by Frank2004; 11-14-2007 at 11:44 PM. |
|
#4
|
|||
|
|||
|
Why have you got "#!/sbin/sh" ?
What is it you are wanting? You can include environment variables in the command as I've shown. Alternatively have the variables in the user's .profile on the other machine. I notice you did not use "$HOME/.profile". |
|
#5
|
|||
|
|||
|
"#!/sbin/sh" told the system the current shell is :/sbin/sh.
we do not want to put all environment variables in the rsh command line as you show. So we edit a shell script named shell-script on the remote host, this script include the contents I've described: Code:
HOME=/data/users/osa . $HOME/.profile or . $HOME/.bash_profille ... nohup $HOME/bin/my_program rsh remote-host -l remote-user shell-script. |
|
#6
|
|||
|
|||
|
Why do you need to set up HOME in the script if the goal is to run the user's .profile?
|
|
#7
|
|||
|
|||
|
HOME is used in user's .profile. Here redefined this variable for confirming. there is nothing to do with this, I can comment it. What I want to do is make sure the path of .profile is correct and can be excuted .
|
|||
| Google The UNIX and Linux Forums |