Copy file one MAC to Another mac

#!/bin/bash hostName=$(scutil --get HostName) installLogName=$hostName-install.log systemLogName=$hostName-system.log server=10.96.81.21 folder=/Logs username=sftp_adm password=R10grandE@ currentUser=$(stat -f %Su /dev/console) if [[ ! -d /private/tmp/Logs ]] then mkdir /private/tmp/Logs fi cp /private/var/log/install.log /tmp/Logs cp /private/var/log/system.log /tmp/Logs mv /tmp/Logs/install.log /tmp/Logs/$installLogName mv /tmp/Logs/system.log /tmp/Logs/$systemLogName cd /tmp/Logs chmod 644 /tmp/Logs/$systemLogName su $currentUser -c "/usr/local/bin/expect<\" send \"cd $folder\r\" expect \"sftp>\" send \"put /tmp/Logs/$systemLogName $systemLogName\r\" expect \"sftp>\" send \"put /tmp/Logs/$installLogName $installLogName\r\" expect \"sftp>\" send \"put /tmp/Logs/$installLogName $installLogName\r\" expect \"sftp>\" send \"quit\" EOF" #sftp -n $username@$server <

Comments

Popular posts from this blog

Restore macOS Server from a Time Machine backup

JAMF Server Upgrade process

Creating a Custom Installer for Mac (PKG Package)