Search
| How to use cron to run GUI applications? |
|
|
|
| How to ? - Linux |
| Written by admin |
| Thursday, 18 November 2010 10:07 |
|
![]() Cron is a time-based job scheduler to run commands, gui applications, shell scripts etc. This howto explains running a GUI application using cron. Cron can be used to automate downloading by starting some applications like wget,gwget,rtorrent,deluge... at a specified time. In Ubuntu and Debian based systems cron is run as a deamon. Type the following command in terminal to check whether cron is running: $ ps ax| grep "cron" 2739 ? Ss 0:00 /usr/sbin/cron 3984 pts/0 S+ 0:00 grep cron Note: The second line of the output specfies our searching. If not installed install it from the repository. Follow this link... to know how to configure cron. Use the command "crontab -e" to edit the cron jobs. To run GUI application using cron in the command section replace the command name part the following way env DISPLAY=:0 gui_appname The env DISPLAY=:0 portion will tell cron to use the current display (desktop) for the program "gui_appname". For example to run the rtorrent client(A terminal based popular torrent client in Linux) the crontab looks like this # m h dom mon dow command 47 09 18 11 * env DISPLAY=:0 gnome-terminal -e rtorrent Which tells to run rtorrent to be run in terminal at Nov 18 at 09:47 AM on all days. If the application is deluge torrent client replace "gnome-terminal -e rtorrent" with deluge. -l switch can be used to list the current cron jobs. $ crontab -l # m h dom mon dow command 47 09 18 11 * env DISPLAY=:0 deluge |
| Last Updated on Thursday, 18 November 2010 10:22 |





