[Solved] caja won't start from crontab

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
rebelxt
Level 2
Level 2
Posts: 69
Joined: Sat Jul 16, 2011 9:48 am

[Solved] caja won't start from crontab

Post by rebelxt »

I'm trying to start caja at boot from crontab in Mint 13 Mate. This is what I put in crontab:

Code: Select all

@reboot         rebelxt    caja
The syslog file shows the command being executed, but the browser window never appears. What else do I need to do?
Thanks for any help.

When I do this to crontab:

Code: Select all

@reboot         rebelxt    caja >> /home/rebelxt/caja.log 2>&1
this message is written to caja.log:
Could not parse arguments: Cannot open display:
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Image
User avatar
karlchen
Level 23
Level 23
Posts: 18229
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: caja won't start from crontab

Post by karlchen »

Hello, rebelxt.

Please, read the manpage of crontab in order to find out the correct structure of the crontab files:

Code: Select all

man 5 crontab
Your crontab line looks incomplete to me.

Second problem:
Having followed my own piece of advice and run

Code: Select all

man 5 crontab
I read this in the manpages:
Please note that startup, as far as @reboot is concerned, is the time when the cron(8) daemon startup. In particular, it may be before some system daemons, or other facilities, were startup. This is due to the boot order sequence of the machine.
This means that you are trying to launch Caja at an extremely early stage of the boot process. It will not work because the needed resources will not have been loaded at that point in time.

Question:
What are you trying to achieve?
Caja is going to be launched automatically after you have logged on in the graphical logon screen. This is the earliest point in time when Caja can be launched.

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
rebelxt
Level 2
Level 2
Posts: 69
Joined: Sat Jul 16, 2011 9:48 am

[Solved] Re: caja won't start from crontab

Post by rebelxt »

The crontab format is right for Linux Mint Mate. This is the default crontab for that distro:

Code: Select all

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
What am I trying to achieve? I just wanted to see something start when the system was booted. This bit that karlchen noted is the reason caja wouldn't start:
Please note that startup, as far as @reboot is concerned, is the time when the cron(8) daemon startup. In particular, it may be before some system daemons, or other facilities, were startup. This is due to the boot order sequence of the machine.
This is the crontab entry that worked:

Code: Select all

@reboot         rebelxt    sleep 10 && export DISPLAY=:0.0 && caja /
The minimum delay time required will depend on the computer, but it is something less than the time required for the desktop to become visible. Also note that the "export DISPLAY=:0.0" command is required.
Image
User avatar
karlchen
Level 23
Level 23
Posts: 18229
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: [Solved] caja won't start from crontab

Post by karlchen »

Hello, rebelxt.

OK, seems that you corrected an error of mine: The keyword "@reboot" at the beginning of a crontab entry replaces the usual "min hour day_of_month month day_of_week" part of the entry. - Hm, yes, sounds logical, @reboot is a unique point in time.
Thanks for explaining how you managed to make it work. :)

Cheers,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
Locked

Return to “Other topics”