Quickly I found that Mac by default disabled the at command. What I needed to do first was to make at enabled. From Stackoverflow, I was redirect to Supperuser.com, from developer's web page to computer user web page. There I got the following answer, using command lauchctl to enable at:
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist
where sudo is to run a command as supper user; launchctl as an interface to run launch to load daeamons; and -w is used to override the Disabled key (in plist) and set is to false.
Just for sure, I rebooted my Mac to give my first try by the following command:
$ at now + 1 minute
say 'Hello, World! This is a scheduled announcement by at command.'
<EOD>
where <EOD> is Control+d key for marking end of doc. After one minute, I heard the announcement from my Mac. Then I tried another command:
$ at now + 1 minute
rm test.txt
<EOD>
This is a command to remove test.txt file in the current path. As scheduled, I confirmed the remove: test.txt file in the current path was gone.
According to the manual of the command at, it is used to run a specific job in a separate process group with no controlling terminal. More information about this command can be found by using man:
man at
For example, -l option is used to list the current scheduled jobs. "atrm job_number" command is for removing a job.
No comments:
Post a Comment