thanks, - I did not expect that $ can be problem - I expected ' {} or ()
Now I am facing another problems:
I use ssh in script to access various systems (solaris, hp-ux, linux...) if I want remote use ifconfig somewhere it works somewhere not.
- I found that that may be the PATH problem or something with sourcing and variables - I am not familiar with it and I am a little bit confused, but anyway it is recommend to use /sbin/ifconfig (as you did)
OK but what if somewhere is ifconfig in another path ? Is possible to use classic ifconfig in script?
- Second problem: Is possible to remote use bash script for loop on system which did not have bash ? Example is more than 1000 words:
The commented line in above code works if it is not in bash script
- Third problem: Is good practice to set environment variables when I log on server via script (to avoid expecting input) ? Is it necessary for script to have set environment variables or is there any better solution ?
Many many thanks
I use ssh in script to access various systems (solaris, hp-ux, linux...) if I want remote use ifconfig somewhere it works somewhere not.
- I found that that may be the PATH problem or something with sourcing and variables - I am not familiar with it and I am a little bit confused, but anyway it is recommend to use /sbin/ifconfig (as you did)
OK but what if somewhere is ifconfig in another path ? Is possible to use classic ifconfig in script?
No, as far as I know, ifconfig's position and syntax varies accross different operating systems,
so I would suggest to use a custom code for your environment.
Quote:
- Second problem: Is possible to remote use bash script for loop on system which did not have bash ? Example is more than 1000 words:
[...]
The commented line in above code works if it is not in bash script
Could you post the exact error message or explain what you mean by "not working"?
Quote:
- Third problem: Is good practice to set environment variables when I log on server via script (to avoid expecting input) ? Is it necessary for script to have set environment variables or is there any better solution ?
I'm not sure about this one. Some ssh client implementations support the -t/-T switch to enable/disable pseudo-tty allocation,
I don't know if setting the above mentioned variables has some impact.
Thank you for other replies
[QUOTE=radoulov;302453138]
Could you post the exact error message or explain what you mean by "not working"?
[QUOTE]
I think problem will be with ! (bang or what is the name in English) I also tried escape it but when i did it then error is in awk not in bash
I want to execute a shell script(set of commands) on remote machine and that script takes input from text file(local machine). Please refer below:
ssh user@hostname 'bash -s'< ./test.sh file.txt
But i got the error file.txt doesn't exist.
Can anyone help me on this.
Content of test.sh:
... (2 Replies)
Hi,
The below command is not giving me the count , Can somebody help me in re-writing this pls .
Proc_Exist=`ssh -q -o "BatchMode=yes" -o "PasswordAuthentication=no" $OAUSER@${Primary_Node} ps -ef |
grep -v grep | grep "${ICM_Proc}" |wc -l `
Also the same problem with below... (13 Replies)
Hi All,
We have 2 servers A and B.
B is having a sctipt called b.sh in path /home/dev/scripts.
Now my requirement is i want to execute b.sh from server A.
Kindly help me. (3 Replies)
I am unable to run the below script against a remote server due to syntax error (then unexpected), but i am able to run it locally. Am i executing it correctly or is there any other way to execute it.
ssh username@servernname ksh -s < scriptname
#!/bin/ksh
function record
{
((end =... (5 Replies)
So, is there way of automating this ?
My ultimate goal is to run some cmd script in windows and it should connect to a remote unix host and run a script x.sh located on the remote unix host.
I was wanting to achieve this by using WinSCP and Putty only. If possible let me know how and if not... (25 Replies)
Hi,
I am new to the expect scripting.
I have this expect script as below :
spawn ssh remote_server -l id
set pass "12345"
set opt "s"
expect "Password:" {send "$pass\r" ; }
expect "*ENTER*" {send "Enter\r"; exp_continue }
expect "Please select option :" {send... (2 Replies)
Hi all,
I'm not sure if it is correct to post here.
I am facing problem wanting to create a batch that run from my Windows XP pc to remote to multiple Solaris server to execute the server's ksh script. :wall:
Can anyone give me a hints on how to do that? Thanks. (6 Replies)
Help please!!
I want to use ssh to execute a remote exe and while it's running I want to query for the process ID of the exe (2 different ssh commands)
1. sshpass -p "<passwd>" ssh -f -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@<ipaddress> nohup /tmp/mmds_asyn &
2.... (0 Replies)
Does anyone know how to execute remote script asynchronously?
Here is my command
TargetList=$testmaker/config/prod_domain.list
for targethost in `cat $TargetList`; do
rsh $targethost -l bvuser "$HOME/var/script-root/afp/bin/run_nrtp_cache_flush.sh $appName"
done (1 Reply)
hi unix guru's
i am new to unix shell programming.
i found a trouble in executing a script(bali.ksh) which is available on serverA with username xyza, this script contains sqlplus command to retrive the data from the database available on other serverC.
Now i need to run the above script... (4 Replies)