Scheduling commands with crontab [Linux]

If you need to schedule a command to be run at a certain frequency, you may be able to use crontab to achieve it.

Note: This guide does not cover setting up services, permissions, etc. You will need to have command(s) that are ready to be run automatically.

Commands

  1. Make a new directory to store your commands and cd into it: mkdir ~/scheduledCommand && cd ~/scheduledCommand
  2. Create and edit a new file where you'll be storing the commands: nano loop.sh
  3. Enter whatever you need. If you have a systemd service called boing installed, you could have the following to restart it.
    #!/bin/bash
    systemctl restart myservice

Create Cron Job

Operators

Cron jobs support 4 different operators:

  • linux, schedule, setup, crontab
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Running a program as a service [Windows]

In this article, we'll be describing how you can turn any Windows program into an auto-restarting...

Installing Python [Windows/Linux]

The following steps detail how you can install Python on a Windows or Linux machine. Python...

Running a program / script forever (and in the background) [Linux]

This article will teach you how to create a looped command in linux, that will run permanently in...