OpenOffice automatic open with Cron

Issues with installing under all Linux Distributions

OpenOffice automatic open with Cron

Postby iammenotyou » Thu Apr 14, 2016 7:09 pm

I have an ubuntu installation (fresh) with a fresh install of OpenOffice.

I've created a spreadsheet in Calc that does some processing every evening.

So I'm trying to open the file every evening at 12:30

So I created a script that contains the following:
soffice --calc --norestore /home/user/Dropbox/Calculator/Updater.ods

and i opened crontab
sudo crontab -e
and added the following lines
30 01 * * * /home/user/Dropbox/updaterscript.sh
30 00 * * * export DISPLAY=:0 && /home/user/Dropbox/updaterscript.sh

If i go into the directory and run the scipt, Calc opens and does exactly what it's supposed to do.

When cron time passes nothing happens for either activity. (Also tried as user as opposed to as root)

I should note, security is not an issue.
LibreOffice 5.1.2.2
Ubuntu 16.04
iammenotyou
 
Posts: 2
Joined: Thu Apr 14, 2016 7:00 pm

Re: OpenOffice automatic open with Cron

Postby acknak » Thu Apr 14, 2016 8:09 pm

In my experience, running GUI software from cron is problematic because they aren't running in a normal, logged-in and configured session. That was a long time ago; maybe it's different now.

I would suggest looking online for examples of command-lines/options for running OO without user interaction. I believe one option for this is --headless.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: OpenOffice automatic open with Cron

Postby iammenotyou » Thu Apr 14, 2016 8:52 pm

ok, so it appears, that with the crontab of
30 00 * * * export DISPLAY=:0 && /home/user/Dropbox/updaterscript.sh

it actually called the script of:
soffice --calc --norestore /home/user/Dropbox/Calculator/Updater.ods

when running the script manually it opens OO and does what it needs to do. The after a 5 minute wait, the autostarted macro saves and exits.

When using cron however, it doesn't open on the screen, just running ps -ef i can see the process is running. The problem is since it opens this way, it doesn't do any of the updates/save/exit.

I should also add that adding --headless to the script caused it to immediately quit after opening. Manually it runs, just not sure if it does anything.

Is there perhaps another tool that I use to schedule running the script, but one that would open the UI as well (like when the script is run manually)?
LibreOffice 5.1.2.2
Ubuntu 16.04
iammenotyou
 
Posts: 2
Joined: Thu Apr 14, 2016 7:00 pm

Re: OpenOffice automatic open with Cron

Postby acknak » Thu Apr 14, 2016 9:42 pm

You're already beyond what I know about it. Sorry my suggestion wasn't more useful.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: OpenOffice automatic open with Cron

Postby RoryOF » Thu Apr 14, 2016 9:45 pm

Try using the cron job to change to the directory, then run the task, rather than run the task from the root using a path.
Apache OpenOffice 4.1.6 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29434
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland


Return to Linux

Who is online

Users browsing this forum: No registered users and 4 guests