# Running a cron job automatically after server reboot

> Run a script or start an application automatically each time a server restarts using the @reboot cron directive.

Source: https://helpcenter.ruachost.com/developers/linux/running-a-cron-job-automatically-after-server-reboot/

**Running a cron job automatically after server reboot**\
Learn how to set up a cron job that runs automatically after a server reboot using the `@reboot` crontab directive, rather than a specific day or time.

This article explains how to run a cron job automatically when a server restarts. For instance, you might want to execute a script or launch an application right after the server comes back online.

To achieve this, use the `@reboot` directive in the cron job. For example, the following cron job runs the `start_application.sh` script located in the user's home directory once after the system restarts:

```
@reboot ${HOME}/start_application.sh
```

> **Note:**
Make sure to specify the full path to the file you want to run in the cron job. Alternatively, you can use Bash environment variables like `${HOME}` and `${USER}` to define the path.

**More information**\
For additional details about the `@reboot` directive and other cron job options, run the following command at the terminal:

```
man 5 crontab
```
