crontab

Mac OS X launchd examples (launchd plist example files)

In an earlier tutorial (Mac OS X startup jobs with crontab, er, launchd) I demonstrated how to use the Mac OS X launchd facility instead of cron to run what would normally be a cron (crontab) job. As I started working with launchd and launchctl, I realized it would probably be helpful to see several different launchd examples, specifically launchd plist file examples.

Mac OS X startup jobs with crontab, er, launchd

Mac OS X crontab question: Help, I want to run a job through the cron (crontab) facility on Mac OS X, how do I do that? I keep trying to edit my crontab file, but my Mac OS X system won't save my changes, or run my program.

Mac OS X - crontab and launchd

Here's the short story about crontab on Mac OS X: The crontab command seems to be deprecated on Mac OS X, and the Apple documentation encourages you to use their "launchd" facility. Here's a blurb from the Mac OS X crontab man page:

Use AppleScript to display a dialog from the Mac OS X Unix shell

Mac Unix shell AppleScript FAQ: How can I display a dialog with AppleScript from the Unix command line shell? (Either from a command line shell like bash through the Mac OS X Terminal, or from a shell crontab job.)

A Linux crontab mail command example

Here's the source code for a really simple Linux mail script that I used to send an email message to one of my co-workers every month. This script used the Unix or Linux mail command to email a file to her that showed a list of all the websites on our server that she needed to bill our customers for.

Here's the source code for this simple Linux mail shell script:

Linux "crontab every" examples

I've posted other Unix and Linux crontab tutorials here before (How to edit your Linux crontab file, Example Linux crontab file format), but I've never included a tutorial that covers the "crontab every" options, as in how to run a crontab command every minute, or every hour, or every day.

To that end, here are some quick "crontab every" example entries that show the syntax for these crontab commands.

Linux crontab man page (crontab file format, section 5)

This page shows the contents of the Linux crontab man page that deals with the crontab file format (syntax), or as it says in the man page, "crontab - tables for driving cron". This crontab man page output was created on a CentOS Linux system.

You can see this same crontab man page output by entering this command on your own Linux system:

Edit your crontab file with crontab -e

I was working with an experienced Linux sysadmin a few days ago, and when we needed to make a change to the root crontab file, I was really surprised to watch him cd to the root user's crontab folder, make changes to the file, then do a kill -HUP on the crontab process.

Thinking he knew something I didn't know, I asked him why he did all of that work instead of just entering this:

Example Linux crontab file

I have a hard time remembering the crontab file format, so I thought I'd share an example crontab file here today. This is the root crontab file from a CentOS Linux server, specifically a server I use in a test environment.

Securing the Drupal cron.php script

I don't know how big of a deal it is yet, but as I learn more about Drupal and security, I just tightened down access to the Drupal cron.php script on this site.

One thing Drupal does is make a "cron" script available off of your root URL, and by default that script is made publicly available. I don't know exactly how this works yet (other than knowing that it fires off several Drupal cleanup tasks), but I really don't want to make that URL publicly available, so after digging around I found this nice Apache configuration solution here:

Linux crontab man page (crontab command)

This page shows the contents of the Linux crontab man page. This crontab output was created on a CentOS Linux system.

You can see this same crontab man page output by entering this command on your own Linux system:

man crontab
Syndicate content