LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-15-2012, 08:27 AM   #1
arthurfabre
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Rep: Reputation: Disabled
Creating a startup script for Openoffice in headless mode


Hello,

I have installed openoffice via "yum install openoffice.org-headless" which installed openoffice as a dependency.
Openoffice should be installed, except I can't figure out how to stop or start it.

Running openoffice.org3 as some tutorials state renders a "command not found"

Other tutorials state I should create a .sh file in /etc/init.d/ to install openoffice as a service except the supplied file is for debian and doesn't seem to work on Centos 6.

Does anyone know where I could find such a file or where I could learn how to do it myself?

Thanks a lot!

Arthur
 
Old 01-15-2012, 09:20 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Presuming that you want to run an OOo process as a server, here's the command I use to start it for local use by unoconv on Debian Squeeze ($soffice_port is the port it should listen on, commonly 2002):
Code:
soffice -headless -accept="socket,host=127.0.0.1,port=$soffice_port;urp;" -nofirststartwizard &
Here are a couple of bash functions that my be useful (msg is a generalised messaging function).
Code:
#--------------------------
# Name: start_soffice_server
# Purpose: starts an OpenOffice.org server
# Return: 0 if OpenOffice.org server is started; otherwise calls finalise
#--------------------------
function start_soffice_server {
    local buf rc

    soffice -headless -accept="socket,host=127.0.0.1,port=$soffice_port;urp;" -nofirststartwizard &
    disown $!        # Suppresses the bash job control job ending message
    for (( i=0; i<wait_for_soffice_server; i++ ))
    do
        sleep 1
        ck_soffice_server && return 0
    done
    msg E "Timed out waiting for $wait_for_soffice_server seconds for OpenOffice.org server to start"
    finalise 1

}  # end of function start_soffice_server

#--------------------------
# Name: ck_soffice_server
# Purpose: checks whether a OpenOffice.org server is running
# Return: 0 if one is running; 1 if not
#--------------------------
function ck_soffice_server {
    local buf

    # Is a soffice.bin process listening on the port?
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    buf=$( netstat --all --numeric --program --tcp 2>/dev/null | grep ":$soffice_port .*LISTEN" )
    if [[ $buf =~ /soffice.bin$ ]]; then
        return 0
    else
        return 1
    fi

}  # end of function ck_soffice_server
Regards the boot script, I no longer have access to a CentOS system but do have a log for a CentOS 5.5 system which records creating boot scripts in /etc/rc.d/init.d/ with 544 permissions and using chkconfig to install links to them in appropriate directories.
 
1 members found this post helpful.
Old 01-15-2012, 09:58 AM   #3
arthurfabre
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the quick reply!

I think I've finally figured it out - I hadn't installed the openoffice.org-writer and openoffice.org-draw packages.

Removed everything with
Code:
yum remove openoffice*
followed by
Code:
yum install openoffice.org-headless openoffice.org-writer openoffice.org-draw
After that your command
Code:
soffice -headless -accept="socket,host=127.0.0.1,port=$soffice_port;urp;" -nofirststartwizard &
worked fine.

Thanks a lot for your help!

Last edited by arthurfabre; 01-15-2012 at 10:10 AM. Reason: EDIT: Nervermind, your command works but my script doesn't
 
Old 01-15-2012, 12:40 PM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
At simplest, you can add the command to /etc/rc.d/rc.local.

For a more fully featured solution there may be a /etc/init.d/skeleton file (if not, try find /etc/ -name '*skeleton*' ) to use as an example for a full boot script.
 
Old 01-15-2012, 12:56 PM   #5
arthurfabre
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
I'll look into that. For the moment I've generated a simple startup script with webmin

Thanks for all your help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating script to change ownership directory on RHEL4U3 at startup Ferianto Linux - Enterprise 9 02-13-2008 11:01 PM
Google Desktop running in headless mode GSMD Linux - Software 0 12-18-2007 03:42 AM
Headless mode support on motherboards xptchina Linux - Hardware 0 09-02-2006 09:37 AM
Creating Tables in OpenOffice Impress MSwal2846 Linux - Software 4 04-10-2006 06:17 PM
openoffice at startup gurra59 Linux - Newbie 6 09-10-2003 10:27 AM


All times are GMT -5. The time now is 08:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration