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
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
6668
Karma
25
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 Leap 42.1 x64, Plasma 5.x

User avatar
google01103
Manager
Posts
6668
Karma
25
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 Leap 42.1 x64, Plasma 5.x

User avatar
MirceaKitsune
Registered Member
Posts
330
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
19765
Karma
87
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.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
MirceaKitsune
Registered Member
Posts
330
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
19765
Karma
87
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.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
MirceaKitsune
Registered Member
Posts
330
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
6668
Karma
25
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 Leap 42.1 x64, Plasma 5.x

User avatar
MirceaKitsune
Registered Member
Posts
330
Karma
0
OS
Yay, it seems to execute now! Adding the full path to the script fixed it. Thanks for the help :)


Bookmarks



Who is online

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