> For the complete documentation index, see [llms.txt](https://appsecurity.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://appsecurity.gitbook.io/devops/operacionnye-sistemy/linux/background-services-and-crons.md).

# Background Services and Crons

Source: <https://abarrak.gitbook.io/linux-sysops-handbook/>

To list the available categories of daemons, run:

```
$ systemctl -t help
```

There are 3 types of daemons: 1. services, 2. sockets, 3. paths. Use the following to see the system's processes in each:

```
$ systemctl
$ systemctl list-units --type=service
$ systemctl list-units --type=socket --state=LOAD
$ systemctl list-units --type=path --all
$ systemctl list-unit-files
```

To view the status of a daemon use the `status` command or its state shortcuts:

```
$ systemctl status kubelet
$ systemctl is-active dockerd
$ systemctl is-enabled sshd.service
```

Additionally, use the following to list a daemon dependencies:

```
$ systemctl list-dependencies nginx.service
```

The cron daemon `crond` is responsible for managing the user's and system's scheduled jobs. Use the command `crontab` to manage jobs and their files in the user account or in the system wide `/etc/crontab`, `/etc/cron.d/` locations.

```
$ sudo crontab -l
$ sudo crontab -e
$ vim /etc/cron.d/my-backup
```

The syntax of crontab entries is captured by the diagram below. Use the <https://crontab.guru/>

![](https://2153289645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lt0t9jAj6bMemvuzk4F%2Fuploads%2FbLEve7xtyWW3Yx6eciGo%2Fimage.png?alt=media\&token=9dcd65c9-c83a-423d-b3f0-82778db2bd0a)

An example of a cron entry that runs backup command, every day at 5:00 AM:

```
0 5 * * * /usr/bin/daily-backup
```
