LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2011, 03:01 AM   #46
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297

Hi,

Yes, it's different from Bash, I recently started to learn it. It's not that difficult and lot's of information can be found on the internet.

Kind regards,

Eric
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-28-2011, 03:07 AM   #47
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
ok thanks maybe Python is a next fase, but now i would like to try what i described in my edited post.

i'm working on it, if i have any question, i'll post them here
 
Old 03-28-2011, 03:35 AM   #48
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

OK, sounds perfect. If you need anything just post here.

Kind regards,

Eric
 
Old 03-28-2011, 03:46 AM   #49
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
i have a question..

the copying with SCP is working, but when i want to execute it (like ./script.sh) it says
Code:
KSH: ./script.sh:  not found
the script has been made executable, so that's not the problem.
i've also tried to change directory and then tried to execute, but it also failed:

Code:
ssh vusbe@wlsdev.intern.vgt.vito.be 'cd /some/folder; ./scp_cd.sh'
i'm i missing something?
 
Old 03-28-2011, 04:03 AM   #50
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

What's the very first line in your script? Are you using Korn shell and not Bash?

Kind regards,

Eric
 
Old 03-28-2011, 04:12 AM   #51
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
This is the script i'm copying to the remote:
Code:
#!/bin/bash/ksh

cd /some/folder/
ll
and this is the script i'm using to run it:
Code:
#!/bin/bash

ssh user@host 'echo test'
scp /dir/scp_cd.sh user@host:/some/folder/
ssh user@host 'pwd'
ssh user@host 'cat /some/folder/scp_cd.sh; cd /some/folder/; ./scp_cd.sh'
this is the result:
Code:
test
scp_cd.sh                                                                      100%   43     0.0KB/s   00:00
/some/folder
#!/bin/bash/ksh

cd /some/folder
ll
ksh: ./scp_cd.sh:  not found
einde
i don't know if it's relevant but the local server is a lunix server and the remote server is HP-UX

Last edited by brownie_cookie; 03-28-2011 at 04:18 AM.
 
Old 03-28-2011, 04:17 AM   #52
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

This seems very strange to me:
Code:
#!/bin/bash/ksh
Type the following in an terminal to find what the path to ksh is:
Code:
which ksh
And change the first line in the first script accordingly. And why are you showing the contents of the script on the remote side, then cd into the directory and execute the script? What's your goal here?

Kind regards,

Eric

---------- Post added 28-03-11 at 11:18 ----------

Hi,

This seems very strange to me:
Code:
#!/bin/bash/ksh
Type the following in an terminal to find what the path to ksh is:
Code:
which ksh
And change the first line in the first script accordingly. And why are you showing the contents of the script on the remote side, then cd into the directory and execute the script? What's your goal here?

Kind regards,

Eric
 
Old 03-28-2011, 04:23 AM   #53
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
local server
Code:
[root@host /]# which ksh
/usr/bin/which: no ksh in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
remote server
Code:
[wlsdev:/some/folder]which ksh
/usr/bin/ksh
so i need to change it in #!/usr/bin/ksh in stead of #!/bin/bash/ksh ?

I'm doing that just because of testing, if i do those commands and they are working, then i know that the next command normally also need to work.

EDIT:
it's working ;-)

thanks for putting me in the right direction.
Can you explain what those /usr/bin/ksh and /bin/bash are? and what the difference is between them

thanks again ^^

Last edited by brownie_cookie; 03-28-2011 at 04:28 AM.
 
Old 03-28-2011, 04:28 AM   #54
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

You call your shell to use with your script in the first line of that same script. If you're using Bash then you should change it to /bin/bash (or whatever your distro uses, find out with the which command as you did for ksh). The 'working' of your commands depends on the shell you're calling. Korn shell doesn't work exactly the same as Bash, parameters are different or non-existent and so on.

Kind regards,

Eric
 
Old 03-28-2011, 04:36 AM   #55
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
ok, thx ^^ you've made my day !!

now i'm going to write a document for myself how to make the scripts, so can look back at it when i don't know it anymore, and maybe also for the people here when i'm gone.
when that's done, i'm going the expend my scripts to what it has to do ;-)

THANK YOU VERY MUCH for helping me !!

and again, when i have any question, you'll find it here but i think i can go a long way from now on

Brownie
 
Old 03-28-2011, 04:44 AM   #56
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Glad to hear you've got it! And documenting what you do is good practice, congratulations on that. You're welcome for the help, that's the whole meaning of LQ, helping each other out with Linux. Have a nice day/week.

Kind regards,

Eric
 
Old 03-28-2011, 04:59 AM   #57
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
i'm sorry but i came up with another problem/question

when i run my script on the remote server (locally, so without the ssh, because i copied it with scp), i get some results (because of the grep) and i put them in a variable (look code above). but how can i give these results back to the local server (not the remote server)?
 
Old 03-28-2011, 05:03 AM   #58
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Normally you should get the output of the ssh user@host 'command' on your screen. What are you getting if you're getting any information. Try one command at a time in the '' and see if you get any output. Try with a command you're sure that will generate output like ls -al. I'm not familiar with HP-UX so a good idea would be to connect to the server and execute the commands locally to see what you get.

Kind regards,

Eric
 
Old 03-28-2011, 05:11 AM   #59
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416

Original Poster
Blog Entries: 2

Rep: Reputation: 12
okay, i'll rephrase my question

on the local server, i copy my small test script (with scp) to the remote server, then i execute the small script.
the small script looks for an ERROR or WARNING in a certain file.
that's working, in my console i see this happening.
So the next stap would be, that e.g. if there is an ERROR i should get back a 1 (one) from the REMOTE to the LOCAL server, so i can interprete this 1 (one) as an ERROR so i can send a notification.

how do i get back the 1 (one)?

it doesn't has to be specifically a 1 (one), just something that i get back from the remote server so i can do something with it.

Perhaps your answer is the same as your answer to this question, but i think it's more clearly now what i'm trying to do
 
Old 03-28-2011, 05:14 AM   #60
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Why do you copy a script over and then execute it? Is there any reason besides maybe the fact that the remote machine is a HP-UX for not putting everything in one script?

Kind regards,

Eric
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
Fedora 10/unable to ssh out from box to remote host (SSH within LAN ok) huskeypm Linux - Networking 3 04-14-2009 07:37 PM
SSH - Remote aplications in remote server Urien Linux - Newbie 11 04-04-2009 04:02 AM
Remote login with SSH, but display on remote computer. brodin Linux - Software 3 09-09-2007 03:01 AM
Remote SSH Kurzweil Linux - Newbie 23 05-14-2005 12:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration