Understanding the Meaning and Behavior of * * * * * (Five Asterisks) in Solaris 8 Cron Job Scheduling


3 views

In Unix-like systems including Solaris 8, the cron utility follows a specific syntax pattern consisting of five time fields followed by the command to execute:

* * * * * command_to_execute

Each asterisk represents a time unit in the following order:

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday=0)
│ │ │ │ │
* * * * *

When you specify five asterisks (* * * * *), this creates a job that runs:

  • Every minute
  • Of every hour
  • Every day
  • Every month
  • Every day of the week

This is effectively the most frequent possible schedule in cron, executing the command once per minute continuously.

Here's a real-world example from the legacy system mentioned:

* * * * * /usr/local/bin/clean_temp_files.sh >/dev/null 2>&1

The >/dev/null 2>&1 portion redirects both stdout and stderr to /dev/null, suppressing all output. This is common for cron jobs where output isn't needed.

While this syntax is technically valid, it's generally not recommended for several reasons:

  • Resource intensive: Running a job every minute can consume significant system resources
  • Potential race conditions: If the job takes longer than a minute to complete, multiple instances may run simultaneously
  • Difficult to monitor: With such frequency, it's hard to track successful executions versus failures

For most maintenance tasks, more reasonable intervals would be:

# Run every 15 minutes
*/15 * * * * /path/to/command

# Run hourly
0 * * * * /path/to/command

# Run daily at 2:30am
30 2 * * * /path/to/command

When working with older Solaris systems:

  • The cron daemon is typically managed via /etc/cron.d/cron.allow and /etc/cron.d/cron.deny
  • System-wide crontab is located at /var/spool/cron/crontabs/root
  • Always use full paths to binaries as Solaris 8 may have different PATH settings

If you're unsure whether a cron job is running:

# Check cron logs (location may vary)
tail -f /var/cron/log

# Verify the cron daemon is running
ps -ef | grep cron

# Test your command manually first
/path/to/your/command

Remember that in Solaris 8, the cron implementation may behave slightly differently than modern Linux systems, particularly around environment variables and command interpretation.


The five asterisks * * * * * in a crontab entry represent the following time fields in order:

┌────────── minute (0 - 59)
│ ┌──────── hour (0 - 23)
│ │ ┌────── day of month (1 - 31)
│ │ │ ┌──── month (1 - 12)
│ │ │ │ ┌── day of week (0 - 6) (0 is Sunday)
* * * * * command_to_execute

When you see * * * * * in a Solaris 8 crontab, it means:

  • The command will execute every minute of every hour of every day
  • This is equivalent to setting up a continuous monitoring or heartbeat process
  • Common uses include:
    * * * * * /path/to/healthcheck.sh >/dev/null 2>&1
    * * * * * /usr/lib/sendmail -bd -q15m
    

On Solaris 8 systems, there are some special behaviors to note:

# The traditional Vixie cron implementation handles wildcards differently than modern cron
# Verify your cron daemon version:
/usr/sbin/cron -V

# Check cron logs (location may vary):
/var/cron/log
/var/adm/cron/log

Here's a complete crontab example demonstrating proper usage:

# DO NOT DELETE THIS LINE - SYSTEM CRONTAB
MAILTO=admin@example.com
PATH=/usr/bin:/usr/sbin:/sbin

* * * * * /opt/scripts/system_check.pl
0 * * * * /opt/scripts/hourly_cleanup.sh

If your wildcard cron job isn't working:

  1. Verify cron is running: ps -ef | grep cron
  2. Check permissions: ls -l /var/spool/cron/crontabs
  3. Test command manually first
  4. Redirect output for debugging:
    * * * * * /path/to/script.sh >> /var/log/cron_debug.log 2>&1