Artix Linux Forum

Artix Linux => Installation / Migration / Configuration => Topic started by: h3xo on 21 March 2023, 09:41:47

Title: updatedb cron jon
Post by: h3xo on 21 March 2023, 09:41:47
I've recently installed plocate, which ships updatedb command to update database and I want to run it daily. How can I achieve it with cronie? Somewhere on internet I found, that running sudo crontab -e and typing @daily /usr/bin/updatedb would work, but it didn't work for me. So should I put some shell script in /etc/cron.daily? And if so, how should it look?
Title: Re: updatedb cron jon
Post by: gripped on 21 March 2023, 10:53:39
Code: [Select]
@daily /usr/bin/updatedb
Should work. I suspect you didn't actually create the crontab entry ?
Did you see this ?
Code: [Select]
/bin/sh: line 1: /usr/bin/vi: No such file or directory
If so this should work (if nano is installed which I think it is by default?)
Code: [Select]
su
EDITOR=nano crontab -e
If you want to do it in cron.daily instead create a file in that directory, make it executable and put this it.
Code: [Select]
#!/bin/bash
/usr/bin/updatedb
Title: Re: updatedb cron jon
Post by: h3xo on 21 March 2023, 18:05:19
I did create crontab, but as root, so if I didn't login as root it had no effect? And thanks for answer!
Title: Re: updatedb cron jon
Post by: gripped on 21 March 2023, 18:31:03
I'm not fully understanding you. You don't have to be logged in for root (or user) cron jobs to run.
Is it working now ?