Reply to topic

Kcron and Task Scheduler

User avatar michelmassoud
Registered Member
Posts
20
Karma
0
OS

Kcron and Task Scheduler

Sat Oct 20, 2012 1:38 pm
I have been trying to start and stop Ktorrent at specific times. I have installed all packages and applications I could find that allowed to do that in a graphical enviroment.

I have installed Kcron but it does not seem to be installed nor will it run from konsole

I have scheduled Ktorrent using Task Scheduler (that is now available in System Settings) and while each command works on its own (Open Ktorrent / Start torrents download / Stop torrents downloads / Quit Ktorrent) the whole schedule does not start at all.

Thanks,

Michel

Last edited by michelmassoud on Sat Oct 20, 2012 3:04 pm, edited 1 time in total.
User avatar google01103
Manager
Posts
4956
Karma
17
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 2:00 pm
what do you mean "the whole schedule does not start at all"?

kcron is now accesible as a kcm in systemsettings -> task scheduler, I don't think there's a separate gui executable per se

kcron (cron) runs without the processes required to run a gui app, by Google'ing you can find a method using the display command to have it run gui apps, see https://help.ubuntu.com/community/CronH ... plications


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 michelmassoud
Registered Member
Posts
20
Karma
0
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 2:58 pm
The tasks I have created in Task Scheduler do not run as scheduled ie Ktorrent is not launched at 00:00, Torrents downloads are not started at 00:05, Toreents downloads are not stopped at 8:00 and Ktorrent is not shutdown at 8:05. Nothing happens at all.

But when I choose "Run Now" in Task Scheduler, each of these tasks runs perfectly ie the first task does launch Ktorrent, the second will start downloads, etc...

Thanks,

Michel

Last edited by michelmassoud on Sat Oct 20, 2012 3:09 pm, edited 1 time in total.
User avatar google01103
Manager
Posts
4956
Karma
17
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 3:08 pm
what command did you execute in task scheduler?


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 michelmassoud
Registered Member
Posts
20
Karma
0
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 3:12 pm
The first one is: /usr/bin/ktorrent
The second is: qdbus org.ktorrent.ktorrent /core startAll
The third is: qdbus org.ktorrent.ktorrent /core stopAll
The fourth is: qdbus org.ktorrent.ktorrent /MainApplication quit

Michel
User avatar google01103
Manager
Posts
4956
Karma
17
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 3:42 pm
kcron (cron) runs without the processes required to run a gui app, by Google'ing you can find a method using the display command to have it run gui apps, see https://help.ubuntu.com/community/CronH ... plications


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
4956
Karma
17
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 5:23 pm
quick note - I use Kalarm for this type of things, as long as your KDE session is up and running it will work for this, just specify a command alarm


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 michelmassoud
Registered Member
Posts
20
Karma
0
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 5:39 pm
I understand that Kcrom is running through Task Scheduler and I will check Kalarm, but what is wrong with my Task Scheduler?

Michel
User avatar google01103
Manager
Posts
4956
Karma
17
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 6:34 pm
cron as defaulted can only run command line apps, it can't run gui based apps as there is no defined display for the gui to interact with and Ktorrent is a gui app but it can be done from https://help.ubuntu.com/community/CronHowto
It is possible to run gui applications via cronjobs. This can be done by telling cron which display to use.
00 06 * * * env DISPLAY=:0 gui_appname

The env DISPLAY=:0 portion will tell cron to use the current display (desktop) for the program "gui_appname".

And if you have multiple monitors, don't forget to specify on which one the program is to be run. For example, to run it on the first screen (default screen) use :
00 06 * * * env DISPLAY=:0.0 gui_appname

The env DISPLAY=:0.0 portion will tell cron to use the first screen of the current display for the program "gui_appname".

Note: GUI users may prefer to use gnome-schedule (aka "Scheduled tasks") to configure GUI cron jobs. In gnome-schedule, when editing a GUI task, you have to select "X application" in a dropdown next to the command field.

Note: In Karmic(9.10), you have to enable X ACL for localhost to connect to for GUI applications to work.
~$ xhost +local:
non-network local connections being added to access control list
~$ xhost
access control enabled, only authorized clients can connect
LOCAL:


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 michelmassoud
Registered Member
Posts
20
Karma
0
OS

Re: Kcron and Task Scheduler

Sat Oct 20, 2012 9:02 pm
Thanks adding env DISPLAY=:0 made it work.

Michel
User avatar michelmassoud
Registered Member
Posts
20
Karma
0
OS

Re: Kcron and Task Scheduler

Thu Nov 29, 2012 10:16 pm
I recently re-installed Kubuntu 12.04 64 bit in place of Kubuntu 12.04 32 bit. I have also activated the backports and upgraded to KDE 4.9.3.

My previous Schedule that consisted of running
Ktorrent -> starting the downloads & uploads -> stopping the downloads & uploads -> exiting Ktorrent
is not running properly anymore. Specifically the command
Code: Select all
 /usr/bin/ktorrent
does not start the application.

The remaining steps are still working as before ie torrents are started, stopped and the application is exiting.

Any ideas on why?

Michel
User avatar google01103
Manager
Posts
4956
Karma
17
OS

Re: Kcron and Task Scheduler

Thu Nov 29, 2012 10:52 pm
so what doesn't happen is that the Ktorrent gui does not show when run from Kcron? could it be that the gui starts minimized in the systemtray and is one of the hidden icons

how do you know "The remaining steps are still working as before ie torrents are started, stopped and the application is exiting."?


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 michelmassoud
Registered Member
Posts
20
Karma
0
OS

Re: Kcron and Task Scheduler

Fri Nov 30, 2012 7:21 am
I looked for the icon Ktorrent but could not find it and Alt tab does not show Ktorrent. I know the remaining steps are running because when I launch Ktorrent manually, the scheduler opens the torrents and when I check the computer in the morning the program is closed.

Thnaks,

Michel
User avatar google01103
Manager
Posts
4956
Karma
17
OS

Re: Kcron and Task Scheduler

Fri Nov 30, 2012 12:26 pm
what happens when you type in Konsole
Code: Select all
Display=:0 ktorrent


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 michelmassoud
Registered Member
Posts
20
Karma
0
OS

Re: Kcron and Task Scheduler

Fri Nov 30, 2012 3:06 pm
michel@michel-Satellite-L650:~$ Display=:0 ktorrent
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
KGlobal::locale::Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work


and Ktorrent is launched.

I entered
Code: Select all
env Display=:0 ktorrent
in task scheduler but it did not launch Ktorrent at the requested time.

Thanks,

Michel

 
Reply to topic

Bookmarks



Who is online

Registered users: AGB, airdrik, alake, artsymptom, Baidu [Spider], Bing [Bot], boudewijn, codetonic, colomar, einar, Exabot [Bot], garthecho, ggael, Google [Bot], google01103, ingwa, jgrulich, ken300, koriun, La Ninje, lunzhy, Majestic-12 [Bot], MSNbot Media, mutlu, NickElliott, notmart, odysseus-art, peje, portnov, rkay, sir_herrbatka, Sogatori, Tuukka, Yahoo [Bot], zabastodwa