Hi all,
I have a script in 5 servers that looks like this: (collector.sh)
#!/usr/bin/sh
cat /var/log/messages | grep -i nscmd > nscmd_output
cat /var/log/messages | grep -i sshd | grep -i accepted > sshd_output
sleep 3
cat nscmd_output sshd_output | sort > user_activity
sleep 2
echo
echo "User Logs for Backup-Server:"
echo "----------------------------"
echo
cat user_activity
echo
echo "User History for Backup-Server:"
echo "-------------------------------"
echo
cat .bash_history
echo
The script will collect all the user activity logs from /var/log/messages and as well as the contents of the .bash_history and will put the printed output into /tmp/ directory.
Cat somebody help me how to create a script that will connect to each server through SSH, then execute the script, then get the logs (thru ftp) after the execution of collector.sh, and put all the generated logs from each server under /tmp/ directory of the main server (Server1)
Let's say, the script will be deployed in Server1, so once I executed it, it will first execute the the collector.sh within its self, and then perform the same actions on each server. So that in Server1 /tmp/ directory I have an output of:
collector_output_server1.log
collector_output_server2.log
collector_output_server3.log
collector_output_server4.log
collector_output_server5.log
Please help and advice,
Best regards,
rymnd_12345