Remotely Executing Shell Script - Problems


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remotely Executing Shell Script - Problems
# 8  
Old 04-09-2014
HI Vgersh99,

I think the purpose of another_script not being executable or write protected is only so that users with the permissions cant mess with them.

Honestly, i don't see the logic in not being able to modify the remote_script.sh as well. to me this could have been done in a much simpler way. Having said that i figured out a workaround for this problem. this is what i'm doing now.

Code:
ssh -qt root@X 'cd /path/to/remote_script/; . anotherscript; ./remote_script'

this resolved my issue.
This User Gave Thanks to Irishboy24 For This Post:
# 9  
Old 04-09-2014
copy the contents into the main script file...you can read it right?
This User Gave Thanks to blackrageous For This Post:
# 10  
Old 04-09-2014
yeah i can read it but didn't have to go that far . i posted the solution in my previous comment. that resolved it. i give you credit though, your idea of copying triggered my action :-)
# 11  
Old 04-10-2014
Once you cd /path/to/remote_script/, anotherscript should be sourceable, too, from within remote_script!
With your solution, you need to make sure that all variables will be exported so they'll be available in the subshell that runs remote_script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Problems executing an interactive shell script

I am new to Unix shell and to this forum. I am having some trouble executing an interactive shell script that I have written using Mac TextEdit that takes a user input via terminal of a file type (jpg or gif) and then activates a script that will iterate through a folder of unsorted file types... (4 Replies)
Discussion started by: Braveheart
4 Replies

2. Shell Programming and Scripting

List and copy dir remotely using shell script

Hi, I am looking for a way to copy the directory on a remote machine that's present on the same remote machine. ex. I have multiple directories on a remote machine "B" created as /abc/LOG_1004 /abc/LOG_1008 /abc/LOG_1012 The script should be able to create a copy of the latest dirs... (1 Reply)
Discussion started by: deo_kaustubh
1 Replies

3. Shell Programming and Scripting

Executing a shell script using sh

Platform : Solaris 10, RHEL 5.4, OEL 6 I've noticed that some of my colleagues execute scripts by typing sh before the script name sh myscript.shI always execute a script by typing the script name and typing enter provided PATH variable has . (current directory) in it myscript.sh (and... (1 Reply)
Discussion started by: John K
1 Replies

4. Solaris

how to execute shell script present in unix machine remotely from windows

how to execute shell script present in unix machine remotely from windows? I having a shell script in my unix machine, need to execute the script remotely from my windows machine using Visual Basic or VBA macros. Thanks In Advance. --Suresh (1 Reply)
Discussion started by: sureshmani
1 Replies

5. Homework & Coursework Questions

Problems executing script

Hi, I'm a complete novice to Linux and UNIX. I'm having trouble getting a script to execute properly. I did a similar script earlier in the semester with no problems. For whatever reason I can't get this one to work. Any help would be greatly appreciated as I'm completely lost and frustrated at... (5 Replies)
Discussion started by: Lindy70
5 Replies

6. Shell Programming and Scripting

Problems with remotely executing scripts

Hi, in the below command, i export a value to a variable which later is used by the script, however i dont see the exported value is actually been exported. ssh user@host "export var=/path/ ; cd /path/ ; ./script" how can i use the above command with proper value of var remotley (7 Replies)
Discussion started by: suraj.sheikh
7 Replies

7. HP-UX

Remotely connecting to HP-UX poses a lot of problems

1)MY HP-UX11iv2 machine is on a specific subnet as in rrr.rr.199.( its a rp3410 blade server).It has 2 hard disks one of them has HP-UX11iv2 and the other hard disk is not being used 2)ip of the hp-ux machine is rrr.rr.199.rrr 3)i need to access this hp-ux machine remotely from a windows machine... (3 Replies)
Discussion started by: rookie8278
3 Replies

8. Shell Programming and Scripting

Remotely executing awk command

ssh user@machine awk '{ split ($1,ar,"!");print ar}' samp >samp1 Error: Unmatched '. However on <machine> awk '{ split ($1,ar,"!");print ar}' samp >samp1 executes successfully. Any suggestions. (1 Reply)
Discussion started by: bishweshwar
1 Replies

9. Shell Programming and Scripting

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... (12 Replies)
Discussion started by: elthox
12 Replies

10. UNIX for Advanced & Expert Users

Shell script is not executing

Hi, I am trying to execute the below shell script: script name(ss1). ss1 was given permission - 744 before executing. name: ss1 #ss1 #usage:ss1 ls who pwd :wq I tried to execute $ss1 (Enter) Its not executing.... It says that ss1 is not found: echo $SHELL. The o/put i got is... (5 Replies)
Discussion started by: dreams5617
5 Replies
Login or Register to Ask a Question