T
T
Twelfth Doctor2016-12-11 17:47:30
linux
Twelfth Doctor, 2016-12-11 17:47:30

Is the job for CronTab correct?

Hello! Is the task for Crontab correctly compiled, which will run the /etc/backup.sh script as root every day?
I run crontab as root with the commandcrontab -e
0 0 * * * /bin/bash /etc/backup.sh >/dev/null 2>&1

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
TyzhSysAdmin, 2016-12-11
@POS_troi

Don't do tasks as root.
Remove the path to the shell from the command, configure the cron normally, for example, see the article www.codenet.ru/webmast/php/cron.php
If something does not work for you, then show the error from the logs.

R
Ruslan Fedoseev, 2016-12-11
@martin74ua

basically correct.
But placing scripts in /etc is bad manners.
PS. In general, you just need to place a link to your script in /etc/cron.daily and it will be executed at 4:02 every day

E
Eugene, 2020-07-07
@zeond

I will add: a very vague concept is correct. For example, we can talk about the cron schedule.
It can be checked in at least two ways:
1. Get a grasp of the man to crontab
2. Use online services that can decrypt the cron format. For example:
- https://crontab.cronbox.ru
- https://crontab.guru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question