Code University

      "Where tuition is free!"

News | Images | Contact     
  • Home
  • Coding KC
  • Scripts
  • Software
  • Templates
  • Tutorials
  • About
 

Scripts

Posted on Jan 31, 2011 at 23:45

Services - OpenOffice: Start as a service


Download File
start_ooffice.sh

Explanation
This script is useful if you need to run a dedicated OpenOffice service on a system. I had a process that generated PDF files from an OpenOffice template document, which required the OpenOffice service to be running on the system at all times. So I setup this script and created a cronjob for it, which ran every morning to make sure the service was always up and functioning properly. Incidently, this script was setup to run in a cygwin environment.

Script snippet that checks to see if service is running: Copy  To New Window  Top ^
CHECK=`/cygdrive/c/Windows/system32/netstat -anpo tcp | grep 127.0.0.1:8100`;
Here we are using netstat to see if the process is running. This command can be broken down as follows: -anpo tcp: This tells netstat to display the state of all sockets [a], show network addresses as numbers [n], show only connections for the protocol specified, tcp in this case [p] and display the owning process ID [o]. grep 127.0.0.1:8100: This piece grabs any process running on port 8100, the port the OpenOffice service runs on, and assigns it to the CHECK variable.
Start-up command for OpenOffice service in script: Copy  To New Window  Top ^
/cygdrive/c/Program\ Files\ \(x86\)/OpenOffice.org\ 3/program/soffice -accept="socket,port=8100;urp;StarOffice.ServiceManager"
This line starts the service. It starts it on port 8100, which is the standard port for OpenOffice.

Tagged:  Bash
Scripts
  • Introduction
  • Backups
    MySQL Dump/Email Mash-Up
    Rsync: A Simple Bash Script
  • Services
    OpenOffice: Start as a service
Resources
  • CodeIgniter - MVC Framework
  • HowtoForge - Linux Tutorials
  • Linux Today - Linux News
  • Lxer - Linux News Feed
  • Monsterb - Linux, Podcasting
  • MySQL - Databasing
  • Perl - Programming
  • PHP - Programming
  • Systhread - Admin & Programming
  • W3Schools - Web Tutorials
About

Code University contains a wealth of technical information aimed at the computer sciences.


 
Home | Coding KC | Scripts | Software | Templates | Tutorials | About
Top ^
 
© 2007-2012 Code University| Disclaimer
Website template by Arcsin