I have 9 servers, on each server a script with common name is available.
I send a token file to all server from 1 particular server. so when a daemon job checks that token file is available then it triggers the script..
I want to know is there any command or script which I will run/execute on one server and it will trigger script on another server/servers.
Thanks in advance
Assuming you have ssh enabled, and ssh-keys from server0 distributed onto server1-server9:
# from your desktop or server0 (or server1 for that matter)
for sv in server1 server server3 # and so on
do
ssh $sv '/path/to/script_that_starts_something.shl'
done
Hello.
#!/bin/sh
for sv in $1 # and so on
do
ssh $sv '/export/home/pin/pin/bin/healthcheck_ONDB.ksh'
done
It did send command to server and script execute also but the functionality script does, it did do any of them..i killed that script.. it even didnt write the txt file also
---------- Post updated at 10:55 PM ---------- Previous update was at 10:42 PM ----------
And how to check ssh is enabled and ssh keys are distributed..
indeed script got triggered but it did not perform functionality.
and i killed it..
---------- Post updated at 11:00 PM ---------- Previous update was at 10:55 PM ----------
if u talking about public key, private key, then yes its on all hosts
If you log in to remote server via ssh and run the script from the command line, Does it work properly?
I'm pretty sure your ".profile" on the remote server(s) do not get sourced(i.e. executed) when running a script or command via ssh(non-interactive), For ksh or sh shell try this:
#!/bin/sh
for sv in $1 # and so on
do
ssh $sv '. ~/.profile; /export/home/pin/pin/bin/healthcheck_ONDB.ksh'
done
script
pin@ssapp1025[wasim]$ cat test.sh
#!/bin/sh
for sv in $1 # and so on
do
ssh $sv '(. $HOME/.profile;/export/home/pin/pin/bin/healthcheck_ONDB.ksh)'
done
Error
+ ssh ssapp1020 (. $HOME/.profile;/export/home/pin/pin/bin/healthcheck_ONDB.ksh)
WARNING: Access to this computer system is limited to authorised users only.
Unauthorised users may be subject to prosecution under the Crimes
Act or State legislation.
Please note, ALL CUSTOMER DETAILS are confidential and must not be
disclosed.
stty: : Invalid argument
logout
stty: : Invalid argument
ksh: MANPATH: parameter not set
in cron we set any job like this
00 23 * * 2 (. $HOME/.profile;/export/home/pin/pin/bin/Tomcat_restart.sh) > /dev/null 2>&1
I got rid of this error
stty: : Invalid argument
but
script
for sv in ssapp1023 # and so on
do
ssh -qt $sv '. /export/home/pin/pin/.profile;/export/home/pin/pin/bin/healthcheck_ONDB/healthcheck.ksh'
done
Now below is result
+ ssh -qt ssapp1023 . /export/home/pin/pin/.profile;/export/home/pin/pin/bin/healthcheck_ONDB/healthcheck.ksh
ksh: MANPATH: parameter not set
logout
Please advice why this parameter not set error is coming
I believe the keys are not setup yet.
In your remote machine, can you please check whether the current server name is added into the ~/.ssh/authorized_keys file ?
Yes I have checked, its all good, I do sftp from one server to another. and private public key is fine..
Any other reason?
This thread might help you
I got rid of this error
:
stty: : Invalid argument
But now only this error
ksh: MANPATH: parameter not set
logout
I believe you should export your MANPATH in your .profile file.
The below link might be useful
https://discussions.apple.com/thread/2187861?start=0&tstart=0
MANPATH is functional in hp/unix, but I am using sunsolaris
its not helping. can someone suggest something which will help me
Sign into the target machine and view/check your(.profile) and validate it has a MANPATH:
Example that works for Solaris:
MANPATH=/opt/csw/share/man:/usr/openwin/share/man:/usr/dt/share/man:/usr/share/man:/usr/openwin/share/man:/usr/local/man:/usr/sfw/man
export MANPATH
Also if possible post the contents of the .profile.
Hello Spacebar,
Below is how MANPATH is set in .profile in my servers
MANPATH=:/usr/man:/usr/local/man:/usr/local/soe/man:/usr/openwin/man:/usr/local/apache2/man:/usr/local/mysql/man:/opt/SUNWldm/man:/opt/VRTS/man:/opt/app/perl/man3
MANPATH=$MANPATH:/opt/app/perl/man3; export MANPATH
I tested these 2 lines in Solaris and they are fine:
MANPATH=:/usr/man:/usr/local/man:/usr/local/soe/man:/usr/openwin/man:/usr/local/apache2/man:/usr/local/mysql/man:/opt/SUNWldm/man:/opt/VRTS/man:/opt/app/perl/man3
MANPATH=$MANPATH:/opt/app/perl/man3; export MANPATH
So something else is going on in your .profile, So that means you will need to post the contents of the .profile you are using so we can see what is causing the problem.
Try changing this statement:
if [ -t ]; then
To:
# Set up the terminal if interactive
if [ `tty -s` ]; then