Lowfokus
Posts Tagged files
Cron Jobs on OS X
Posted by technohermit in Apple, OS X Shell, Uncategorized, Unix on 2009/11/15
Since OS X Tiger, cron has been replaced by a utility called launchd, and three separate launch daemons. Rather than having to run crontab to manipulate scripts, they are run by launchd according to three separate directories inside of /etc/periodic.
The scripts contained in these folders are run at specified intervals by three preference files, in XML format, found in the /System/Library/LaunchDaemons folder. You can manipulate the .plist files with a text editor or Apple’s Property List Editor (if you’ve installed Developer Tools.) They are named, simply enough, com.apple.periodic-daily.plist, com.apple.periodic-weekly.plist, andcom.apple.periodic-monthly.plist. They are, by default, set to run at the same time as the old cron jobs, in the middle of the night. If you happen to shut down your Mac, it might be a good idea to change these intervals to a time when you’re sure the computer will not be shut down, as these jobs are important.
You will find a script in each of these folders called 999.local. This file is set to read-ony by default, and is for ”backwards compatibility with the old /etc/daily.local” according to the comments in the file. (I’m running Snow Leopard.) I’d recommend not modifying the scripts in the /etc/periodic folders, and creating a /etc/daily.local, /etc/weekly.local, and /etc/monthly.local file for your cron jobs, as you have the 999.local script in each of the daily, weekly, and monthly sub-directories of /etc/periodic to tell your scripts to run. Any future system updates could change the default files in those three directories, so if you modify those you may end up losing your scripts. Avoid that by setting up your own.
If you are running aTiger, the 999.local file may not exist, and you will have 500.daily, 500.weekly, and 500.monthly files inside their appropriate /etc/periodic directories. You should still create a daily.local, weekly.local, and monthly.local script file and place them in the /etc directory, and they will be called from the respective 500.* file.
Resizing An Image Without An Image Editor — Using Automator
Posted by technohermit in Apple, Automator, OS X, Uncategorized on 2009/10/25
This is a fast and easy way to scale the size of an image (or a bunch of images) using OS X’s built in utility Automator. It is very simple (also crude), but it works and the results are pretty decent.
(You can scroll down to the end of the post if you just want the Automator applications and don’t care how I got there.)
First set up the job in Automator by opening the application in /Applications:
Next, choose workflow from the opening screen and select choose (or just hit enter if they’re already highlighted):
The next screen has built in functions to select by category. In the first column, select “Files & Folders“. Column 2’s selections are based upon what you select in column 1. Now the next additions to your workflow will depend upon your desired task. If you’d like to convert a single image, or if you plan on converting a bunch of images in a folder.
First we’ll cover how to make a simple workflow that you can use to select one image, start the workflow, and exit Automator.
With “Files & Folders“ selected in the first column, drag “Get Selected Finder Items“, followed by “Copy Finder Items” into the right hand area.
Next, in the first column, select Photos. Find “Scale Images” and drag that to the right hand actions area, so it is at the bottom. Your workflow should look like this:
Next, we want to adjust an options on ”Copy Finder Items” and “Scale Images” to force the workflow to ask for a values, rather than having to manually open Automator, change them, and click “Run”. That Would be tedious, and we are looking for simple. So, click the options button in the “Copy Finder Items” and ”Scale Images” portions of your workflow, and click the check box “Show This Action When Workflow Runs” in both of them:
With that done, just use the “Save As” in the file menu (⇧⌘S) and save the file as an application:
That’s it, really. You can now drag an image file onto the new application, it will ask you where to save the resized image, as well as ask you for the type of scale. You can set by percentage, or by pixels, and set the value based upon how you chose to scale it. Scaling by pixels appears to be based upon the width, and then uses the same scale factor to the height automatically.
Now, you can adjust this application to do a whole batch of files inside a folder, if you’d like. First, open Automator, click “Open Existing Workflow”, and choose your new application created above. Drag “Get Folder Contents” and place it under “Get Selected Finder Items” in the workflow. Your new workflow should look like this:
Again, click “Save As” in the file menu, and select a new name for this application. You can now drag a folder of images and drop it on the application to resize a batch of images.
There are other options in the Photos section of the Library of actions (the left hand column) such as changing the file type as well, for instance if you have a bunch of jpg’s and want to make them png’s for the web.
I hope this gets you interested in Automator–a totally useful and underrated tool–and happy image scaling!
Download the Single File Application or the Folder of Images Application here if you’d like. You can update and change them by opening them with Automator.





