I am wanting to automate the running of a weekly backup of certain folders on my Mac to the cloud when I am connected to my home network.
Scenario:
Check wifi network name
If 'home' then perform backup
else exit
I have created a calendar event to trigger an automator script.
I currently have two bash scripts
- to determine the wifi network that i am connected to
- to perform the backup (using rclone)
The part i am struggling with is the If, Then, else part.
Bash script 1:
/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print $2}'
Attempt at applescript:
on run {input, parameters}
if input is not ("home") then error number -128
return input
end run
Bash Script that should run on detection of home network:
/usr/local/Cellar/rclone/1.52.1/bin/rclone copy "Source" Remote:folder
Both bash scripts work but i am stuck on the conditional part.... any help gratefully received.
