buymeasoda RefDocs
  • Overview
  • General
    • Android
    • Apache
    • Fish
    • Git
    • Github
    • Gmail
    • Homebrew
    • iOS
    • iTerm
    • MacOS
    • MacPorts
    • Mamp
    • Media
    • Mercurial
    • MySQL
    • Node
    • npm
    • nvm
    • Obsidian
    • PHP
    • React Native
    • Rust
    • Server
    • Slack
    • Sourcegraph
    • Tools
    • Vim
    • VS Code
    • Yarn
  • Unix
    • Checksum and hash utilities
    • Command line history
    • Command line keyboard shortcuts
    • Compress files and folders
    • Crontab
    • Diff files and folders
    • Disk usage and file sizes
    • Find and search files
    • Firewall configuration
    • Help and manual pages
    • HostName and Local HostName for Mac OSX
    • Navigating the file system
    • Network, domains and routing
    • Run and manage background tasks
    • Secure FTP SFTP and Secure Copy SCP
    • Secure Shell SSH
    • Sync files and folders
    • System and process management
    • System and user information
    • Useful characters
    • Useful commands
    • User, file and group permissions
    • Working with cURL
    • Working with files and directories
    • Working with text
Powered by GitBook
On this page
  1. Unix

Crontab

List (-l), edit (-e) and remove (-r) crontab entries

crontab -l
crontab -e
crontab -r

Edit crontab for a different user

sudo -u <user> crontab -e

Example crontab entry (run php script every 30 minutes)

30 * * * * cd /path/to/script; php -q script.php > /dev/null

Timing format

  • min (0-59) / hour (0-23) / day of month (1-31) / month (1-12) / day of week (0-6, 0=Sunday)

  • Use asterisk in a specific slot to represent every instance (eg. every hour, day etc)

Crontab Command Tips

  • Separate multiple statements for one cron instruction with ;

  • Suppress error/output by redirecting result to > /dev/null

PreviousCompress files and foldersNextDiff files and folders

Last updated 3 years ago