Posts: 26
tuto
Joined: 07 Aug 2016
#1
Hi, friends... __{{emoticon}}__

I am running AntiX-13.2 on desktop PC with Intel Pentium 4 1.7 GHz processor, Nvidia GeForce2 MX/MX 400 graphics, 512 MB RAM, 1 GB swap and 13 GB HD.

I am have a problem with crontab. I am running a bash script from user's crontab but no effect, although cron daemon execute the assigned cronjob.

For test the crontab problem, I used two scripts that I known well function it. These scripts show a systray icon for layout keyboard used.

The first script (xkblayout_indicator.sh) use yad --notification for create the systray icon. Then, when click on icon, the second script (sp_chr-xkb.sh) is executed, showing a dialog box with the layout keyboard. Below are screenshots:

first:
xkblayout_indicator.sh bash script, located in $HOME directory:
Image

second:
sp_chr-xkb.sh bash script, located in /usr/local/bin directory:
Image

When xkblayout_indicator.sh bash script is executed from terminal, result:
Image

This discard that script is not source problem.


But after add the path to script in user's crontab file:
Image


and system reboot, no generate systray icon:
Image

The permission of second script are well:
Image

Here the antixers (sudoers file) in / etc/sudoers.d directory:
Image

My user is added to crontab group:

Code: Select all

tesistas@Tesistas:~
$ id
uid=1000(tesistas) gid=1000(tesistas) groups=1000(tesistas),7(lp),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),102(crontab),103(fuse),109(netdev),110(mlocate),1001(storage)
I tried execute these scripts with gnome-scheduler and same result.

I searched on the internet but no I have not found solution.
I wait that you can help me..!

Thank you for read.
Last edited by tuto on 17 Aug 2016, 15:18, edited 1 time in total.
Posts: 64
reverseDog
Joined: 13 Jul 2016
#2
Cronjobs that evoke graphical apps usually need to be told what display to use.

Try adding the line

Code: Select all

export DISPLAY=:0.0
at the top of your script (of course not before the #!/bin/bash though).

Alternativly specifying the display within the crontab might work too:

Code: Select all

* * * * * export DISPLAY=:0.0 && sleep 10 && /home/tesistas/Portables/xkblayout_indicator.sh
Posts: 26
tuto
Joined: 07 Aug 2016
#3
Hi reverseDog. Thanks for reply.

Is true; that line was missing... I added to within the crontab and work fine.

Thank you very much.

I terminate this topic.