P
P
Printip2020-06-04 07:38:02
linux
Printip, 2020-06-04 07:38:02

How to run crontab -e command at system startup?

1. Made a vpsk on Hetzner
2. Set up cron there
3. I give a snapshot I raise
20 copies and cron does not work on half of them. And it starts working only after I write open the cron through the command:
crontab -e
the solution is needed "quick", so I think it would be nice to just run the crontab -e command once at system startup

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valdemar Smorman, 2020-06-04
@smorman

Maybe:
sudo crontab -e; sudo /etc/init.d/cron restart
with this option, the task is written to a file:
/var/spool/cron/crontabs/root
and Cron itself is restarted and the task will be executed as root.
The fact is that very often, having registered a task in Cron , it does not work until you restart it ...
And if it's simple:
crontab -e(without sudo )
then the task is written to a file:

/var/spool/cron/crontabs/имя_пользователя_в_системе

and the task will be executed from the current user, if he exists (if in his session).

K
Karpion, 2020-06-04
@Karpion

Look at the logs - maybe it says why it does not start.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question