Page 1 of 1

[SOLVED] Crontab problem

PostPosted: Jan 20th, '14, 02:20
by nightshadow
Hello there,

My entry in crontab won't work at all.
Code: Select all
[nightshadow@localhost ~]$ crontab -l
@reboot /home/nightshadow/conky.sh

But nothing happens when I reboot.Everything works fine if I use time, and not @reboot.
But with @reboot, it just won't work.
File conky.sh exists, and has +x permission.I can run it with ./conky.sh from cli, and it works.
What could be the problem ?

Regards,
Darko.

Re: Crontab problem

PostPosted: Jan 20th, '14, 03:32
by Ken-Bergen
If conditions do not yet exist for what your script does it will fail.
So what does your script do?

Re: Crontab problem

PostPosted: Jan 20th, '14, 11:11
by ITA84
The script is located inside your home directory, so maybe Cron tries to run it before /home is mounted (I've read someone had the same problem with an encrypted /home). See if it works when moved somewhere else (say, /usr/local/bin).

Re: Crontab problem

PostPosted: Jan 20th, '14, 17:59
by nightshadow
Ken-Bergen wrote:If conditions do not yet exist for what your script does it will fail.
So what does your script do?

Code: Select all
[nightshadow@localhost ~]$ cat /usr/local/bin/conky.sh
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export DISPLAY=:0.0
/usr/bin/conky
[nightshadow@localhost ~]$



ITA84 wrote:The script is located inside your home directory, so maybe Cron tries to run it before /home is mounted (I've read someone had the same problem with an encrypted /home). See if it works when moved somewhere else (say, /usr/local/bin).

Tried it now, didn't work.

Re: Crontab problem

PostPosted: Jan 20th, '14, 21:49
by doktor5000
Why not put it into /etc/X11/xinit.d/ as with a cronjob it's probably racy, as you don't check if the X server is already running.

Re: Crontab problem

PostPosted: Jan 20th, '14, 23:38
by nightshadow
That works.Thanks.

Re: Crontab problem

PostPosted: Jan 20th, '14, 23:46
by doktor5000
Please mark the thread accordingly by editing the topic of the first post and prefix it by [SOLVED], thanks