Reply to topic

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

User avatar MirceaKitsune
Registered Member
Posts
131
Karma
0
OS
Till I get to that, I noticed something else; If I open the System Monitor and filter with "cron", only one process with this name is running from root. Shouldn't I have a process called cron or kcron on my username? This does feel like for some reason the service might not be starting up somehow.
User avatar google01103
Manager
Posts
4960
Karma
17
OS
you should have only 1 cron in Ksysguard, it's a daemon for all cron jobs for all users

Kcron is not a daemon it's just a KDE gui front end for setting up cron jobs


OpenSuse 13.1 x64, KDE 4.12.x

Problem solved? Please click on Image below the post with the best answer to mark your topic as solved.
User avatar google01103
Manager
Posts
4960
Karma
17
OS
you could try creating a cron job using the crontab command (Google for a tutorial) and bypassing kcron, to see if there's a kcron issue.

crontab -l will display any cron jobs you've scheduled using crontab or kcron


OpenSuse 13.1 x64, KDE 4.12.x

Problem solved? Please click on Image below the post with the best answer to mark your topic as solved.
User avatar MirceaKitsune
Registered Member
Posts
131
Karma
0
OS
google01103 wrote:you could try creating a cron job using the crontab command (Google for a tutorial) and bypassing kcron, to see if there's a kcron issue.

crontab -l will display any cron jobs you've scheduled using crontab or kcron


The crontab -l command lists my task correctly.

Code: Select all
mircea@linux-qz0r:~> crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/kde-mircea/systemsettingsW10283.tmp installed on Wed Mar 20 16:50:58 2013)
# (Cronie version 4.2)
#Automatic data backup
0 6 * * *       autobackup


# File generated by KCron the Wednesday 20 March 2013 16:50.
mircea@linux-qz0r:~>
User avatar bcooksley
Administrator
Posts
18607
Karma
83
OS
This appears to be setup correctly then.
The 'root' cron process will execute the backup command as scheduled under your user account when necessary.

Note that if "autobackup" is not in PATH it will likely fail to execute (Cron usually uses a restricted definition of PATH as well).
Also note that processes run by cron will not have access to your graphical console, or desktop session. They should ideally be full independent CLI scripts.


System Settings and Device Actions KCM maintainer
Image
User avatar MirceaKitsune
Registered Member
Posts
131
Karma
0
OS
bcooksley wrote:This appears to be setup correctly then.
The 'root' cron process will execute the backup command as scheduled under your user account when necessary.

Note that if "autobackup" is not in PATH it will likely fail to execute (Cron usually uses a restricted definition of PATH as well).
Also note that processes run by cron will not have access to your graphical console, or desktop session. They should ideally be full independent CLI scripts.


Ahhh... that might be it then. The "autobackup" script file is located in ~/bin so simply typing its name in bash executes it. I noticed that Kcron asks me to define path variables at the bottom of the menu still, but I thought those are optional and system paths are automatically used. What should I add there? Do I include "/home/username/bin" or "~/bin"?
User avatar bcooksley
Administrator
Posts
18607
Karma
83
OS
In this instance, just provide the full path to the command - as it will be the method most assured of success.
ie. /home/username/bin/autobackup

You should ensure that this script has an appropriate shebang line if it is a script, as you may be relying on bash features without being aware.


System Settings and Device Actions KCM maintainer
Image
User avatar MirceaKitsune
Registered Member
Posts
131
Karma
0
OS
bcooksley wrote:In this instance, just provide the full path to the command - as it will be the method most assured of success.
ie. /home/username/bin/autobackup

You should ensure that this script has an appropriate shebang line if it is a script, as you may be relying on bash features without being aware.


Will add the full path. What line should I add though? I already have the #!/bin/bash line... should I add the .sh extension too (and name the file autobackup.sh)?
User avatar google01103
Manager
Posts
4960
Karma
17
OS
As long as the file's permission is executable and the #! /bin/bash is the first line it should execute fine. The use of ".sh" is more for informational purposes.


OpenSuse 13.1 x64, KDE 4.12.x

Problem solved? Please click on Image below the post with the best answer to mark your topic as solved.
User avatar MirceaKitsune
Registered Member
Posts
131
Karma
0
OS
Yay, it seems to execute now! Adding the full path to the script fixed it. Thanks for the help :)

 
Reply to topic

Bookmarks



Who is online

Registered users: AElfwine, anditosan, Baidu [Spider], bcooksley, Bing [Bot], doublerainbow64, Exabot [Bot], Google [Bot], google01103, hefeweiz3n, inksi, jensreuterberg, kainz.a, koriun, l3u, moisachedaniela, Paulms, pbCyanide, raphaelpoli, scummos, SecretCode, Sentynel, toad, tparrott, Yahoo [Bot]