P
P
Pavel2019-05-10 13:27:27
ubuntu
Pavel, 2019-05-10 13:27:27

How to execute a job in cron using sudo?

I do a cron task on my username
crontab -e
0 */3 * * * /home/gray/bbnvp.sh
to execute a file every 3 hours. But inside the commands that need to be executed using sudo , how is it to get everything right?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2019-05-10
@karabanov

Give the user the ability to execute these commands with sudo without a password, or immediately run as root.

V
vreitech, 2019-05-10
@fzfx

run visudo
and there at the end:
gray ALL=(ALL) NOPASSWD: bbnvp.sh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question