This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Kcron won't run scheduled tasks, even if testing them works

Tags: None
(comma "," separated)
User avatar
MirceaKitsune
Registered Member
Posts
330
Karma
0
OS
Yesterday I installed kcron and read how to use it to schedule a command at a specific hour. I went to System Settings -> Task Scheduler and created a new task, setting it to occur every day at a certain hour. I even tested the task by clicking the "Run Now" button and it worked, so I clicked apply and looked at the clock. However, once the hour came, nothing happened and the task didn't run.

What can cause kcron to not run tasks at the scheduled hour, even if they do work when you test them?
User avatar
google01103
Manager
Posts
6668
Karma
25
what command are you running?


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
google01103
Manager
Posts
6668
Karma
25
if you're running a gui app then there's an issue, cron jobs are executed in a non-display environment and since there is no display the app can't run BUT you can assign a display and it should work, something like
Code: Select all
export DISPLAY=:0 && kedit

of course you'll need to be logged in so DISPLAY 0 exists, accomplishing this otherwise is supposedly possible using Xvfb (search on semicomplete.com)

Suggestion - look at kalarm, you'll need to be logged in but it's very versatile an has additional features

PS - as to why the test worked, I'm guessing it just runs the command in the current environment and not in the environment it will eventually be run in and I think that's a bug


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
MirceaKitsune
Registered Member
Posts
330
Karma
0
OS
I use only the menu in Configure Desktop. Here's a screenshot just to be clear:

Image

It's not a GUI app but a shell script that I'm scheduling. I tested closely and clearly it doesn't execute. So I'm still not sure what to do.
User avatar
google01103
Manager
Posts
6668
Karma
25
check both your and roots mail to see if cron mailed error reports, just type "mail" as yourself and as root


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
MirceaKitsune
Registered Member
Posts
330
Karma
0
OS
google01103 wrote:check both your and roots mail to see if cron mailed error reports, just type "mail" as yourself and as root


It says "No mail for (username)". I went to Account Details and configured my email address however... will see if it becomes aware of it automatically. Funny way for errors to be logged though (by email)... what server does it even use?
User avatar
google01103
Manager
Posts
6668
Karma
25
it's an internal Linux command type "man mail" for more info

did you check mail for root? just in case


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Please also make sure that the cron daemon is actually running, assuming KCron manages your user crontab.
Some distributions may not be automatically starting it.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
google01103
Manager
Posts
6668
Karma
25
maybe cron daemon is not installed? in openSUSE, it should automatically start

make sure cron, cronie and cronie-anacron packages are installed, if so reinstall them


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
MirceaKitsune
Registered Member
Posts
330
Karma
0
OS
google01103 wrote:maybe cron daemon is not installed? in openSUSE, it should automatically start

make sure cron, cronie and cronie-anacron packages are installed, if so reinstall them


cronie-anacron wasn't. Installed it now and will see how it goes.
User avatar
google01103
Manager
Posts
6668
Karma
25
make sure you reinstall cronie also as it is what should automatically start the daemon

Also in yast
yast -> system -> system services (run level) -> cron, is it enabled? it should say yes with no asterik, asterik means it did not start though it was supposed to


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
google01103
Manager
Posts
6668
Karma
25
was the pc on at 6am? if the machine is not on at 6 then the cron job does not run it, cron assumes the machine is on 24/7. the reason for anacron is to handle those jobs scheduled to run a time time the pc is off by shifting the time for the job to start


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
MirceaKitsune
Registered Member
Posts
330
Karma
0
OS
google01103 wrote:make sure you reinstall cronie also as it is what should automatically start the daemon

Also in yast
yast -> system -> system services (run level) -> cron, is it enabled? it should say yes with no asterik, asterik means it did not start though it was supposed to


Yes, cron is enabled in "System Services (runlevel)".

And my test was at an hour other than 6:00 (that's the main task I set up initially). But yes the machine is running throughout the night and therefore up at that hour.
User avatar
google01103
Manager
Posts
6668
Karma
25


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
google01103
Manager
Posts
6668
Karma
25
if you only want the job to run when you have your KDE session running try Kalarm (it's what I use)


OpenSuse Leap 42.1 x64, Plasma 5.x



Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]