task program with crontab.

dostoyevski

New Member
Joined
Oct 27, 2020
Messages
27
Reaction score
6
Credits
208
I want to program a task with crontab. This is the bash file:
#! / bin / bash
export JAVA_HOME = / usr / lib / jvm / jdk1.8.0_261
java -jar /home/luilli/Desktop/dist/table.jar


and this is the crontab command:
32 12 * * * /home/luilli/firstboot.sh

has permissions to run, i change them with:
chmod 744 firstboot.sh

i tryed to run the bash file directly from the terminal , and it runs perfect.
 


Try adding an amperstand to the end of the second line so that it looks like this:
Code:
 java -jar /home/luilli/Desktop/dist/table.jar &
 
still doesn't work
Also the first line shouldn't have so many spaces a path doesn't have spaces in it, it should probably look like this:
Code:
 export JAVA_HOME = /usr/lib/jvm/jdk1.8.0_261
 
doesn't worked. I have to add that the bash file runs perfect when i type in the terminal: /home/luilli/firstboot.sh
 
Can you share the table.jar file, that way I can try it out on my test system?
 
Last edited:
I got it working now, your cronjob should look like this.
Code:
32 12 * * * DISPLAY=:0 /home/luilli/firstboot.sh
Replace the value of DISPLAY with the value of your display. You can find that out by typing echo $DISPLAY in the terminal. Cron doesn't know what display to use when the graphical application is started, by setting it in the cron it will know to which display to run the application.
 
Last edited:
Last edited:
yes, when you login
What Desktop Environment are you running? Usually if you search for "startup" or "startup applications" in the menu of your Desktop Environment you will be find an application where you can add applications that should launch when the user logs in.
 

Members online


Latest posts

Top