Archive

Archive for the ‘Linux’ Category

OpenOffice headless mode

October 12th, 2010 Comments off

There are some quite specific cases where it is desirable to have OpenOffice.org run in headless mode on servers, mainly for document conversion. But typically its a bit harder to make that convenient. There are a few places that provide ways to start that and a couple of init scripts, but nothing with much polish. Hopefully the following script will fill that gap for some…

Combined from scripts and tips found at the following pages…

http://chrisschuld.com/2008/10/rhel5-init-initd-script-for-openoffice-org/

https://code.google.com/p/openmeetings/wiki/OpenOfficeConverter

http://wiki.debian.org/LSBInitScripts

#!/bin/bash
# openoffice.org  headless server script
#
# chkconfig: 2345 80 30
# description: headless openoffice server script
# processname: openoffice
#
# Author: Vic Vijayakumar
# Modified by Federico Ch. Tomasczik
# Lsb + compatibility for rhel and debian added by Glenn Enright
#
### BEGIN INIT INFO
# Provides:          openoffice-headless
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Manage openoffice document conversion daemon
# Description:       Enable service provided by daemon.
### END INIT INFO
 
[ -e /etc/init.d/functions ] && . /etc/rc.d/init.d/functions
 
OOo_HOME=/usr/bin
SOFFICE_PATH=$OOo_HOME/soffice
PIDFILE=/var/run/openoffice-server.pid
 
set -e
 
function start {
if [ -f $PIDFILE ]; then
echo "OpenOffice headless server has already started."
return
fi
echo "Starting OpenOffice headless server"
$SOFFICE_PATH -headless -nologo -nofirststartwizard -accept="socket,host=127.0.0.1,port=8100;urp" &> /dev/null 2>&1
touch $PIDFILE
}
 
function stop {
if [ -f $PIDFILE ]; then
echo "Stopping OpenOffice headless server."
killall -9 soffice &&; killall -9 soffice.bin
rm -f $PIDFILE
return
fi
echo "Openoffice headless server is not running."
}
 
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
echo "Pausing a moment to allow full shutdown" && sleep 5
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac

Minidlna: quick init script for ubuntu lucid

October 12th, 2010 Comments off

Reposted for posterity, sorry lost the source link…

echo "
# miniDLNA upstart script
#
# This task runs miniDLNA.  it's currently a work in progress
 
description     "miniDLNA start-up script"
author          "Craig Chambers"
 
start on (net-device-up IFACE=eth0)
 
expect fork
 
respawn
exec /usr/local/sbin/minidlna -f /etc/minidlna.conf
" >  /etc/init/minidlna.conf
Categories: Am a Geek, Linux Tags: , , , , ,

Firefox 3 slow? Time to vacuum the database…

December 7th, 2009 Comments off

From mozillalinks.org

A few months ago, I posted how to improve Firefox performance by defragmenting its database files executing SQLite VACUUM command. The only con was that it required a Firefox restart to execute the command.
Thanks to Mozilla’s Jeremy Orem, we have now learned it can be done from within Firefox in two short steps:
* Open the Error Console: Tools menu/Error Console
* In the Code text box paste this (it’s a single line):
Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeSimpleSQL(“VACUUM”);
* Press Evaluate. All the UI will freeze for a few seconds while databases are VACUUMed
Note however that the procedure optimizes the Places database only, but this is precisely where you will get the most significant performance improvements.

Categories: Linux, Quick cuts Tags: , , , , ,

Auditing shell commands in bash

October 15th, 2009 Comments off

Bash has a built in history function that records recent shell commands. But by default it only retains a raw list of those without attaching additional information. You can add a timestamps to each command by adding something like…

1
echo 'export HISTTIMEFORMAT="%F-%R%t"' >> ~/.bashrc

… and then after reloading your shell session you will see something like …

1
2
3
:~$ history | tail -n 2
 502  2009-10-15-11:26 vim .bashrc
 503  2009-10-15-11:26 history | tail -n 2

You can see much more about what you can do with bash and the history command, including redirecting history commands in the bash and date man pages for your favourite linux distro.

Update: Another option on a debian system (possibly others) would be to use the snoopy package, as described at http://www.debian-administration.org/articles/88

Categories: Linux Tags: , , ,

Ubuntu 9.04 bug with networking directory creation « RimuHosting Blog

September 10th, 2009 Comments off

Ubuntu 9.04 bug with networking directory creation « RimuHosting Blog.

I ran ifup and got the following errors
root@charon ~ # ifup eth0
ifup: failed to open statefile /var/run/network/ifstate: No such file or directory
… so i checked and /var/run/network did not exist… This link had a bit more technical information. They said look for  the following files and remove them.
/etc/udev/rules.d/85-ifupdown.rules
/lib/udev/rules.d/85-ifupdown.rules

A good solution to a tricky issue after an major upgrade.

While I am a big fan of Ubuntu and I use it regularly on my desktop, its fair to say that I prefer not to use it for server installations. The same things goes for Fedora. Actually just don’t use Fedora :) . Silly bugs like those above are one of the reasons.

If I had to make a recommendation, it would be for Debian stable or CentOS/RHEL. Both are reasonably easy to use, with great community support. And I find they have a much more more consistent toolchain so that things are less likely to break and are better testing before getting into production systems. Keeping in mind this is for a server.

Mind you, no distro is 100% perfect, and some needs will differ. All YMMV and IMHO :)