uninstall-cron - Remove Cron Jobs

uninstall-cron - Remove Cron Jobs

The uninstall-cron command removes Update-Watcher cron jobs from the current user’s crontab. You can remove a specific job type or all Update-Watcher jobs at once.

Usage

Terminal
update-watcher uninstall-cron [--type TYPE] [--all]

Flags

FlagTypeDefaultDescription
--type TYPEstringcheckJob type to remove: check or self-update.
--allboolfalseRemove all Update-Watcher cron jobs regardless of type.

How It Works

When the install-cron command creates a cron entry, it includes an identifying comment for each job type:

Crontab
# update-watcher scheduled check
0 7 * * * /usr/local/bin/update-watcher run --quiet 2>&1 | logger -t update-watcher
# update-watcher self-update
0 3 * * 0 /usr/local/bin/update-watcher self-update 2>&1 | logger -t update-watcher

The uninstall-cron command:

  1. Reads the current user’s crontab.
  2. Searches for lines matching the comment marker for the specified job type (or all types with --all).
  3. Removes the comment line and the associated command line.
  4. Writes the updated crontab.

Examples

Remove the Check Job

Terminal
update-watcher uninstall-cron
Output
Update Check cron job removed successfully.

Remove the Self-Update Job

Terminal
update-watcher uninstall-cron --type self-update
Output
Self-Update cron job removed successfully.

Remove All Jobs

Terminal
update-watcher uninstall-cron --all
Output
All update-watcher cron jobs removed.

Verify Removal

After removing cron jobs, verify they are gone:

Terminal
crontab -l

The Update-Watcher entries should no longer appear in the output.

Dedicated Service User

If the cron jobs were installed under a dedicated system user, remove them with:

Terminal
sudo -u update-watcher update-watcher uninstall-cron --all

Or edit the user’s crontab directly:

Terminal
sudo crontab -u update-watcher -e

Related