User avatar
Coynmond
Posts: 14
Joined: Fri Dec 09, 2016 9:04 pm
Location: Ireland

[Solved] How to use dcron?

Sun Feb 04, 2018 4:29 pm

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?
Last edited by Coynmond on Fri Feb 16, 2018 9:16 pm, edited 1 time in total.
I think the Linux phenomenon is quite delightful. ~ Dennis Ritchie

User avatar
gimcrack
Posts: 79
Joined: Mon Jan 01, 2018 9:39 pm
Contact: Website

Re: How to use dcron?

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

User avatar
Coynmond
Posts: 14
Joined: Fri Dec 09, 2016 9:04 pm
Location: Ireland

Re: How to use dcron?

Sun Feb 04, 2018 9:30 pm

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.
I think the Linux phenomenon is quite delightful. ~ Dennis Ritchie

User avatar
kyrios
Posts: 1521
Joined: Thu Sep 22, 2016 4:20 pm

Re: How to use dcron?

Sun Feb 04, 2018 10:38 pm

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.

User avatar
Coynmond
Posts: 14
Joined: Fri Dec 09, 2016 9:04 pm
Location: Ireland

Re: How to use dcron?

Fri Feb 09, 2018 8:15 pm

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
I think the Linux phenomenon is quite delightful. ~ Dennis Ritchie

User avatar
Coynmond
Posts: 14
Joined: Fri Dec 09, 2016 9:04 pm
Location: Ireland

Re: How to use dcron?

Fri Feb 16, 2018 9:15 pm

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.
I think the Linux phenomenon is quite delightful. ~ Dennis Ritchie

Return to “Other Questions”