Hot answers tagged

3

You can add your script in ~/.bash_profile where ~ represents the homedir of the user for which running the script is intended.


2

You could do this with EC2 Run Command if you have that agent installed, though it may be a better fit for something like a Cloud-Init configuration that you put in the user-data for each instance. Alternatively consider using AWS OpsWorks to configure the nodes as desired at boot time, or generate a golden image with Packer such that the config is placed ...


2

Try netstat -ant | egrep '(:80|:443) .*:.*ESTABLISHED' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c or netstat -nt | awk '$4 ~ /:(143|993)$/ && $6 ~ /ESTABLISHED/ {print $5}' | cut -d: -f1 | sort | uniq -c netstat -nt lists TCP connections without DNS lookups of the IP address egrep ':(80|443) .*:.*ESTABLISHED' selects ESTABLISHED ...


1

In response to your original question, you could install mpssh- Mass Parallel SSH and use it to run commands on all your instances. The first time you run it, you may need to type "yes" 150 times, unless you want to ignore host key checking.


1

The number of files to process is ~1,000,000, and it takes dozens of minutes. So you are running around 600 jobs per second. The overhead for a single GNU Parallel job is in the order of 2-5 ms, so when you are getting more than 200 jobs per second, GNU Parallel will not perform better without tweaking. The tweak is to have more parallels spawining jobs ...


1

For all coming via google to this question because they are looking for a way to list remote files but can not access the remote server via ssh (common case for backup servers) you could use 'sftp'. Example: sftp username@hostname.xyz ls cd somedir exit Start an interactive session in a specific remote directory: sftp [user@]host[:dir]


1

inotifywait from inotify-tools is useful if you want to run a command every time a file (or any files in a directory) change. For example: inotifywait -r -m -e modify /var/log | while read path _ file; do echo $path$file modified done



Only top voted, non community-wiki answers of a minimum length are eligible