Registered Member
|
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? |
Manager
|
what command are you running?
|
Manager
|
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
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 |
Registered Member
|
I use only the menu in Configure Desktop. Here's a screenshot just to be clear:
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. |
Manager
|
check both your and roots mail to see if cron mailed error reports, just type "mail" as yourself and as root
|
Registered Member
|
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? |
Manager
|
it's an internal Linux command type "man mail" for more info
did you check mail for root? just in case |
Administrator
|
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] |
Manager
|
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 |
Registered Member
|
cronie-anacron wasn't. Installed it now and will see how it goes. |
Manager
|
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 |
Manager
|
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
|
Registered Member
|
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. |
Manager
|
|
Manager
|
if you only want the job to run when you have your KDE session running try Kalarm (it's what I use)
|
Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]