Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

S.B.G

Moderator
Original poster
Staff member
Sep 8, 2010
26,702
10,488
Detroit
I'm still searching around the Internet on how to do this, but I want to ask here, too.

I've setup a Raspberry Pi to run a Mediawiki on the LAN. I also wanted to figure out how to backup said Raspberry Pi as well. I was able to successfully run a backup over the network from the Pi to the Mac mini as outlined in this post using rsync.

The backup job:
From Terminal I executed this code to sync the folder on the Raspberry Pi to the Mac.
Code:
rsync -avz -e ssh pi@10.0.1.84:/var/www/html/mediawiki/ MediaWikiBU/

Now I want to automate that backup process and I assume cron is the appropriate method to do it, but I haven't figured that part out yet.

The Mac mini is on the latest version of Mojave.
 

chrfr

macrumors G5
Jul 11, 2009
13,732
7,310
I'm still searching around the Internet on how to do this, but I want to ask here, too.

I've setup a Raspberry Pi to run a Mediawiki on the LAN. I also wanted to figure out how to backup said Raspberry Pi as well. I was able to successfully run a backup over the network from the Pi to the Mac mini as outlined in this post using rsync.

The backup job:


Now I want to automate that backup process and I assume cron is the appropriate method to do it, but I haven't figured that part out yet.

The Mac mini is on the latest version of Mojave.
Launchd is really the preferred way to schedule events on macOS. This is a good basic overview: http://www.launchd.info
 
  • Like
Reactions: neliason

S.B.G

Moderator
Original poster
Staff member
Sep 8, 2010
26,702
10,488
Detroit
Launchd is really the preferred way to schedule events on macOS. This is a good basic overview: http://www.launchd.info
Ok, that led me to find out that I could do this as a workflow with Automater. Trying to setup an AppleScript and its stopping me at authentication. The user name and password are indeed correct.
Code:
on run {input, parameters}
    do shell script "rsync -avz -e ssh pi@10.0.1.84:/var/www/html/mediawiki/ MediaWikiBU/" user name "pi" password "NotMyRealPassword" with administrator privileges
    return input
end run
Screen Shot 2018-11-25 at 10.49.20 AM.png
 
Last edited:

chown33

Moderator
Staff member
Aug 9, 2009
11,006
8,904
A sea of green
Ok, that led me to find out that I could do this as a workflow with Automater. Trying to setup an AppleScript and its stopping me at authentication. The user name and password are indeed correct.
Code:
on run {input, parameters}
    do shell script "rsync -avz -e ssh pi@10.0.1.84:/var/www/html/mediawiki/ MediaWikiBU/" user name "pi" password "NotMyRealPassword" with administrator privileges
    return input
end run
View attachment 806454
I'm not sure I understand why you've got admin privileges there. That AppleScript feature is for running with admin priviliges on the Mac, i.e. using your Mac's admin account. You don't typically need admin privileges to login to another host (the Pi). If you do, then you need to supply the password on that host, which may differ from the password on the Mac originating the connection.


Another thought that comes to mind: is the Mac-resident user named "pi" a member of the sudoers group? That is, can you login to your Mac as "pi", and then run commands with 'sudo'? Because I'm almost certain that the "with admin privileges" feature of AppleScript is connected in some way to 'sudo' or the sudoers group. The 'admin' or 'wheel' groups are other possibilities.

The file that controls 'sudo' is /private/etc/sudoers. It's protected by default, so you'll need admin privileges to read it:
Code:
sudo cat /private/etc/sudoers
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.