I have gone through many answers as to how to add a crontab through terminal through one liners and came across only one single option everywhere which is
{crontab -l; echo "1 * * * * /usr/bin/firefox" } | crontab -
Running which all I am receiving is
>
That's it. A promt for me to type something.
and second option being
(crontab -l; echo "1 * * * * /usr/bin/firefox" ) | crontab -
Which seems to add the cron to /var/spool/cron/crontabs/root
but does not open firefox
every minute, in fact it does not open at all.
I read most on most answers that you should not edit the /var/spool/cron/crontabs/root
or /etc/crontab
files directly.
Is this not supported in my system or what?
An output of uname -a
gave the following description of my system
Linux earth 4.9.0-kali4-amd64 #1 SMP Debian 4.9.30-2kali1 (2017-06-22) x86_64 GNU/Linux
EDIT: Following message logs are repeated often in my /var/spool/mail/mail
logs
From root@localhost.localdomain Sun Jul 09 16:01:12 2017 Return-path: < root@localhost.localdomain > Envelope-to: root@localhost.localdomain Delivery-date: Sun, 09 Jul 2017 16:01:12 +0530 Received: from root by earth with local (Exim 4.89) (envelope-from <root@localhost.localdomain>) id 1dU9UY-0001Ry-3A for root@localhost.localdomain; Sun, 09 Jul 2017 16:01:06 +0530 From: root@localhost.localdomain (Cron Daemon) To: root@localhost.localdomain Subject: Cron <root@earth> /usr/bin/firefox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Cron-Env: < SHELL=/bin/sh > X-Cron-Env: < HOME=/root > X-Cron-Env: < PATH=/usr/bin:/bin > X-Cron-Env: < LOGNAME=root > Message-Id: < E1dU9UY-0001Ry-3A@earth > Date: Sun, 09 Jul 2017 16:01:06 +0530
Error: GDK_BACKEND does not match available displays
1 * * * * /usr/bin/firefox
to/var/spool/cron/crontab/root
but it just doesn't start firefox. Had a look onservice cron status
. it is running too. It does not add this to/etc/crontab
although, if that is important. – GypsyCosmonaut Jul 08 '17 at 22:05/var/spool/mail
) – johannes Jul 09 '17 at 11:05Error: GDK_BACKEND does not match available displays
repeated so many times in my logs, check the question above, I have updated it with the error. What do I do? – GypsyCosmonaut Jul 09 '17 at 11:321 1 * * * export DISPLAY=:0 && xhost local:$USER && /usr/bin/firefox
so now it works perfect. Found my solution from this link with your help. https://serverfault.com/questions/280558/need-with-crontab-and-gui-python-popup Thank you so much.. – GypsyCosmonaut Jul 11 '17 at 07:39