Page 1 of 1

[Solved] How to use dcron?

Posted: Sun Feb 04, 2018 4:29 pm
by Coynmond
Hi.

How do I use dcron?

I want to run this command which I currently run in cron on Debian, it deletes all files over 100 days old in the downloads folder:

Code: Select all

45 9,17 * * * find ~/Downloads -mtime +100 -delete
Does dcron only cover user cron jobs? Or also root cron jobs?

Re: How to use dcron?

Posted: Sun Feb 04, 2018 6:10 pm
by gimcrack
I believe you have to use systemd for this task. Cron doesn't work in Solus, the last time I read about it.

https://wiki.archlinux.org/index.php/Systemd/Timers

https://www.freedesktop.org/software/sy ... timer.html

Re: How to use dcron?

Posted: Sun Feb 04, 2018 9:30 pm
by Coynmond
gimcrack wrote:
Sun Feb 04, 2018 6:10 pm
I believe you have to use systemd for this task. Cron doesn't work in Solus, the last time I read about it.

https://wiki.archlinux.org/index.php/Systemd/Timers

https://www.freedesktop.org/software/sy ... timer.html

Hi gimcrack.

I'm totally lost there.

Re: How to use dcron?

Posted: Sun Feb 04, 2018 10:38 pm
by kyrios
Coynmond wrote:
Sun Feb 04, 2018 9:30 pm
Hi gimcrack.

I'm totally lost there.
This is a bit old, but perhaps it's better explained
Basically you have to create a service file that will launch your script/command and a timer file that will define when the service should be executed. The target is less important, just use "multi-user.target" as in the first example and it will be fine.

Re: How to use dcron?

Posted: Fri Feb 09, 2018 8:15 pm
by Coynmond
Actually what I could do perhaps is put a few lines in a script to run at login. That is - link to a bash script in the startup section in the MATE control panel.

How about this? The 2 end ones are just examples and the 2nd command will delete files older than 1 day old from trash (also solves another thread I made here).

Code: Select all

#!/bin/bash

find ~/Downloads -mtime +100 -delete ;  find ~/.local/share/Trash/* -mtime +1 -delete ; command3 ; command4

exit 0

Re: How to use dcron?

Posted: Fri Feb 16, 2018 9:15 pm
by Coynmond
The 'find ~/Downloads -mtime +100 -delete' part of the script ran fine. I can use the 'trash-empty 1' command at startup for auto clearing my trash bin.