【问题标题】:Applescript to trigger Time Machine in Mac OS X 10.9 MavericksApplescript 在 Mac OS X 10.9 Mavericks 中触发 Time Machine
【发布时间】:2013-12-08 12:22:32
【问题描述】:

多年来,我一直使用以下 Applescript 从 Applescript 中触发 Time Machine。它似乎不再适用于 Mac OS X 10.9 Mavericks。任何人都知道解决方案或替代方案。此脚本运行并且不会抛出任何错误消息。它什么都不做。

do shell script "/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper >/dev/null 2>&1 &"

【问题讨论】:

    标签: operating-system applescript osx-mavericks timemachine


    【解决方案1】:

    您可以在 10.7 及更高版本中使用 tmutil:

    do shell script "tmutil startbackup"
    

    -b 会阻止脚本,直到保存快照完成,因此您可以执行tmutil startbackup -b&&diskutil eject Time\ Machine 之类的操作。 -a 以类似于自动计划备份的模式执行备份。

    startbackup [-a | --auto] [-b | --block] [-r | --rotation] [-d |
            --destination dest_id]
            Begin a backup if one is not already running.
    
            Options:
                --auto           Run the backup in a mode similar to system-
                                 scheduled backups.
                --block          Wait (block) until the backup is finished
                                 before exiting.
                --rotation       Allow automatic destination rotation during
                                 the backup.
                --destination    Perform the backup to the destination corre-
                                 sponding to the specified ID.
    
            The --auto option provides a supported mechanism with which to
            trigger "automatic-like" backups, similar to automatic backups
            that are scheduled by the system. While this is not identical to
            true system-scheduled backups, it provides custom schedulers the
            ability to achieve some (but not all) behavior normally exhibited
            when operating in automatic mode.
    

    【讨论】:

    • 至少在 macOS High Sierra 中您需要tmutil 的管理员权限。所以该行将是:do shell script "tmutil startbackup" with administrator privileges - 您将被提示输入用户名和密码。
    猜你喜欢
    • 1970-01-01
    • 2013-11-11
    • 2013-11-17
    • 1970-01-01
    • 1970-01-01
    • 2014-06-27
    • 2014-03-20
    • 1970-01-01
    相关资源
    最近更新 更多