10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a variable called $a1 which maps to something like "http://servername proxy1 count http" and a lots of entries in a file on remote server.
If I have the following in my .sh script:
sed -i "\%$a1%d" mylog.txtthe line is deleted from mylog.txt. Great.
I'm trying now to remvoe this from a... (3 Replies)
Discussion started by: say170
3 Replies
2. Shell Programming and Scripting
If I am running a bash command, and some awk getting the ethernet adapter on the local machine. It works fine. But if I will run it from the remote, it is EMPTY on echo and throwing error in grep.
Thank you
This work perfectly fine
$ f=`/sbin/ip a|grep 127.127 | awk '{print $NF }' ` ; ip... (2 Replies)
Discussion started by: kenshinhimura
2 Replies
3. Shell Programming and Scripting
Hello i am having an issue with bash script and this is the code
now=$(cat hosts1.txt | awk '{print $2;}')
while read n ;do
ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers'
When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies
4. Red Hat
I want to use the below but since the date has a space it doesn't grep exactly what's needed. I need to keep the quotes around the variable when it passes it. I need the quotes around $DATE2 just to recognize the variable. Thanks in advance for any help given.
D=`date +%d`
DN=`echo -n $D |... (3 Replies)
Discussion started by: toor13
3 Replies
5. Shell Programming and Scripting
How should i make the following code working
#!/bin/bash
INPUTFILE="test.txt"
while read STRING; do
IP=`host -t A $STRING | awk '{print $NF}'`
HOSTNAME=`ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no $IP "hostname"`
echo $HOSTNAME > out.txt
done < $INPUTFILE
At this moment while... (3 Replies)
Discussion started by: urello
3 Replies
6. Shell Programming and Scripting
Hi,
i have a shellscript, where in i need to connect to different server start these three jobs and exit from the server and start the same three jobs on local server.
ssh user@remotehost 'bash -s' << EOF
${GETT_HOME}/bin/start1 &
sleep 10
${GETT_HOME}/bin/start2 &
sleep 10... (1 Reply)
Discussion started by: swapnabhargav
1 Replies
7. Shell Programming and Scripting
I am running a useradd script, which works locally but I want to take some of that local information and send it to a remote system, ssh keys are set up between the two systems. I am attaching the script, look at the section titled
"Sending information to FTP2"
Removed attachment, added... (0 Replies)
Discussion started by: slufoot80
0 Replies
8. Shell Programming and Scripting
Hi all,
Scenario - trying to run a batch job on a second machine.
DIR=directory
user=user
server=server
Here is what i have- ssh user@server 'sleep2; cd $DIR; <jobname>'
I have got access to the correct directory, i checked with a pwd command previous.
Problem is the job i... (1 Reply)
Discussion started by: Hopper_no1
1 Replies
9. Shell Programming and Scripting
Hi,
WHen I login to the host using ssh, it sources bash_profile then bashrc file, and reads in my path and other variables.
But when I want to execute a command remotely, it is not sourcing my bash_profile or bashrc files and I dont get the env I want. THis is causing a lot of problems.
HOw... (1 Reply)
Discussion started by: sardare
1 Replies
10. Shell Programming and Scripting
Hi guys,
I am trying to do a ssh for performing a set of actions.
Find it below:
I need to put the user/ kernel/ DISTRO variables before I complete this operation.
what I observed is when ever I put a `command` in those quotes, it performs thta action in local system rather than remote one.... (5 Replies)
Discussion started by: jbmukund
5 Replies