The Mac runs on Unix, which makes it incredibly powerful. You might be running MAMP or a stand-alone version of Apache, and one of the things that you might want to run is cron, which is a scheduling tool. Instead of cron though, you could actually have your Mac just run a launch daemon.
Just go to terminal, and type:
sudo vim yourfile.cron.plist
You’ll be asked for your administrator password, and after entering it, you’ll be brought to the vim screen. Press fn+i to go into insert mode. Now paste the following in:
Once done, press esc, and type :wq to save and quit.
This will actually create the property list file that will contain the information of the task that you want to run. Just paste in the following code, remembering to change “yourfile.cron” to your actual filename (notice this is the same as your filename, but without the .plist extension), and modifying the Program Arguments to fit your needs.
StartInterval is currently set at 1200, which is 20 minutes in seconds (20 minutes * 60 seconds). So if you want to, change this value too.
When you’re done editing, just hit esc, and type in :wq to write the file and quit. Now that the file is saved (you will probably need to enter your administrator password), just run the following commands to load the daemon:
sudo launchctl load /Library/LaunchDaemons/yourfile.cron.plist
Or unload the daemon:
sudo launchctl unload /Library/LaunchDaemons/yourfile.cron.plist
And there you have it – the way to run cron or cron-like jobs with your Mac!
- How To Reset The MySQL Root User Password and Privileges
- How To Mount An ISO File in Mac OS X
- How To Fix The Problem Of Icons Disappearing in Your Mac’s Dock
- How To Activate/Install GD Library In WAMP Under Windows
- How to find and replace a text string in all files on your cPanel / WHM / Linux / Unix server