WGET command in putty console - linux

I am trying to run a wget command do download from a given list in background and if the file is arleady on disk to be overriten
the command that try to use is :
wget -b -N -q -x -i liks.txt
But is not working. I am doing something wrong.?
I am running the command on a CENTOS VPS

Related

SSH remote execute command after using pbrun

I am using a script that executes the following command in a bunch of servers:
sshpass -p password ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no user#server 'sudo yum -y install NessusAgent.x86_64'
For most servers it works using sudo, but in some of them I only have pbrun bash for executing commands with privileges.
My issue is that when I make changes to the command:
sshpass -p password ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no user#server 'pbrun bash; yum -y install NessusAgent.x86_64'
It just hangs up in there and I get no response until I just hit CTRL-C to kill it. I tried ssh with -t flag, but it puts me straight into the target server's shell and that's not what I want.
Is there a way to use pbrun and execute the command without the issues I am experiencing?
I have never used power broker, but I think your problem is the ; ...
Can you try:
'pbrun bash -c "yum -y install NessusAgent.x86_64"'
instead of your
'pbrun bash; yum -y install NessusAgent.x86_64'

Amazon Linux curl

bash -c "$(curl -s https://install.prediction.io/install.sh)"
I run the above script on and ec2 instance running Amazon linux to install prediction IO. Nothing happens no error. Does anyone know whats going on?
That command downloads a file in silent mode $(curl -s https://install.prediction.io/install.sh) and then run the file with bash -c.
you should run the command in separated steps to check what it is going on
curl -O https://install.prediction.io/install.sh
chmod +x install.sh
./install.sh
First, check whether the like https://install.prediction.io/install.sh is accessible from your Amazon EC2.
curl -v https://install.prediction.io/install.sh
If its working, try this
curl -s https://install.prediction.io/install.sh | bash

Installation of Cron in cygwin

When I run the following command in cygwin,
$ cygrunsrv -I cron -p C:\cygwin64\bin --args -n
I get the following error
cygrunsrv: Given path doesn't point to a valid executable
Why am I getting this error?
You only gave a folder and not a path to the executable. Besides this I wouldn't recommend to use windows paths in cygwin, this can cause errors. You should write /cygdrive/c/cygwin64/bin/something instead of C:\cygwin64\bin\something.exe
Perhaps you are looking for an
installation guide, and you would like to do something like this:
Install cron as a windows service, using cygrunsrv:
cygrunsrv -I cron -p /usr/sbin/cron -a -D
net start cron

bash & s3cmd not working properly

Hi I have a shell script which contains s3cmd command on ubuntu 12.04 LTS.
I configured cron for this shell script which works fine for local environment but don't push the file to s3. But when i run shell script manually, It pushes the file to s3 without any error. I checked log and found nothing for this. Here is my shell script.
#!/bin/bash
User="abc"
datab="abc_xyz"
pass="abc#123"
Host="abc1db.instance.com"
FILE="abc_rds`date +%d_%b_%Y`.tar.gz"
S3_BKP_PATH="s3://abc/db/"
cd /abc/xyz/scripts/
mysqldump -u $User $datab -h $Host -p$pass | gzip -c > $FILE | tee -a /abc/xyz/logs/app-bkp.log
s3cmd --recursive put /abc/xyz/scripts/$FILE $S3_BKP_PATH | tee -a /abc/xyz/logs/app-bkp.log
mv /abc/xyz/scripts/$FILE /abc/xyz/backup2015/Database/
#END
This is really weird. Any suggestion would be a great help.
Check if the user running configured in crontab has correct permissions and keys in the environment.
I am guessing the keys are configured in env file as they are not here in the script.

How to do ssh in a bash script with lot of commands?

I tried to run the following command in a bash script but only till ./install.sh rereplica is called . Rest of the commands are not called at all.
ssh $node2user#$node2 "cd /tmp; tar -xf $mmCS.tar; cd $mmCS; ./install.sh csreplica; ./install.sh keepalived $vip low;./install.sh haproxy $node1:8080 $node2:8080 $vip:8080; ./install.sh confmongo $dbPath"
You can give ssh a script on standard input:
ssh $node2user#$node2 < my_script.sh
If I have to do execute a complex script using SSH, I usually write a script locally, copy it on the target machine with SSH and then execute it there:
scp foo.sh $node2user#$node2:
ssh $node2user#$node2 "bash ./foo.sh"
That way, I can debug the script simply by invoking it with bash -x and I can use the full power of BASH.
Alternatively, you can use
ssh $node2user#$node2 "set +x; cd /tmp; ..."

Resources