OpenERP Server 5 Daemon

1. Ikuti langkah di dokumentasi OpenERP sampai dengan instalasi OpenERP Server. Hal yang harus diperhatikan adalah user Linux yang akan menjalankan daemon (User yang dibuat pada langkah pembuatan user postgresql)

2. Buat daemon

sudo pico /etc/init.d/openerp-server

3. Copy Paste script di bawah ini ke file dari langkah 2

#! /bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenERP Server – the server
# Description: OpenERP is a complete ERP and CRM software
## END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=openerp-server
NAME=openerp-server
DAEMON=/usr/bin/openerp-server # <– SESUAIKAN DENGAN LOKASI BIN HASIL SETUP
# Specify the user name (Default: terp).
USER=”agin” # <– SESUAIKAN DENGAN USER YANG AKAN MENJALANKAN OPENERP-SERVER
# Specifty an alternate config file (Default: ~/.openerp-serverrc)
CONFIGFILE=”/etc/openerp-server.cfg”
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon
DAEMON_OPTS=”-c $CONFIGFILE”
# Exit if the package is not installed
[ -x $DAEMON ] || exit 7
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
# function that starts the daemon/service
#
if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then
do_start() {
start-stop-daemon –start –quiet –pidfile $PIDFILE \
–chuid $USER –background –make-pidfile \
–exec $DAEMON — $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
#
# Function that stops the daemon/service
do_stop() {
start-stop-daemon –stop –quiet –pidfile $PIDFILE –oknodo
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
start-stop-daemon –stop –quiet –pidfile $PIDFILE –oknodo
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
start-stop-daemon –start –quiet –pidfile $PIDFILE \
–chuid $USER –background –make-pidfile \
–exec $DAEMON — $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
else
do_start() {
$DAEMON $DAEMON_OPTS > /dev/null 2>&1 &
RETVAL=$?
sleep 5 # wait for few seconds
echo $! > $PIDFILE # create pidfile
return $RETVAL
}
do_stop() {
pid=`cat $PIDFILE`
kill -15 $pid
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
if [ -f $PIDFILE ]; then
do_stop
fi
do_start
return $?
}
fi
start_daemon() {
if [ -f $PIDFILE ]; then
echo “pidfile already exists: $PIDFILE”
exit 1
fi
echo -n “Starting $DESC: ”
do_start
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo “failed.”
exit 1
fi
echo “done.”
}
stop_daemon() {
checkpid
if [ $? -eq 1 ]; then
exit 0
fi
echo -n “Stopping $DESC: ”
do_stop
if [ $? -eq 1 ]; then
echo “failed.”
exit 1
fi
echo “done.”
}
restart_daemon() {
echo -n “Reloading $DESC: ”
do_restart
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo “failed.”
exit 1
fi
echo “done.”
}
status_daemon() {
echo -n “Checking $DESC: ”
checkpid
if [ $? -eq 1 ]; then
echo “stopped.”
else
echo “running.”
fi
}
case “$1” in
start) start_daemon ;;
stop) stop_daemon ;;
restart|force-reload) restart_daemon ;;
status) status_daemon ;;
*)
N=/etc/init.d/$NAME
echo “Usage: $N {start|stop|restart|force-reload|status}” >&2
exit 1
;;
esac
exit 0
# vim: sts=4 st=4 et

4. Ubah mode file /etc/init.d/openerp-server (dari langkah 2) agar dapat diexecute oleh semua user

sudo chmod +x /etc/init.d/openerp-server

5. Buat auto-start ketika boot

sudo update-rc.d openerp-server defaults

6. Buat config file

sudo pico /etc/openerp-server.cfg

7. Copy-Paste ke file config

[options]
#without_demo = False
netport = 8070
secure = False
demo = {}
#syslog = true
cache_timeout = 100000
port = 8069
smtp_password = False
secure_pkey_file = server.pkey
netinterface =
#log_level = 20
admin_passwd = admin
smtp_port = 25
smtp_server = localhost
db_user = agin # <– SESUAIKAN DENGAN USER YANG AKAN MENJALANKAN OPENERP-SERVER
price_accuracy = 2
import_partial =
soap = False
#pidfile = true
db_maxconn = 64
reportgz = False
xmlrpc = True
#db_port = False
debug_mode = False
netrpc = True
secure_cert_file = server.cert
#interface =
#logfile = False
csv_internal_sep = ,
pg_path = None
translate_modules = [‘all’]
stop_after_init = False
root_path = /usr/local/lib/python2.6/dist-packages/openerp-server # <– SESUAIKAN DENGAN LOKASI ROOT DARI OPENERP SERVER HASIL PROSES SETUP
smtp_user = False
db_password = False
db_name = False
db_host = False
assert_exit_level = 30
email_from = False
addons_path = /usr/local/lib/python2.6/dist-packages/openerp-server/addons # <– SESUAIKAN DENGAN LOKASI ADDONS DARI OPENERP SERVER HASIL PROSES SETUP
logfile = /var/log/openerp-server.log

8. Buat logfile untuk openerp-server

sudo touch /var/log/openerp-server.log

9. Ubah kepemilikan file config

sudo chown openerp /var/log/openerp-server.log

Sesuaikan owner file log dengan user yang akan menjalankan openerp-server

10. Ubah mode file bin yang tercantum pada $DAEMON di /etc/init.d/opeerp-server (dari langkah 2) agar dapat diexecute oleh semua user

sudo chmod +x /usr/local/bin/openerp-server

11. Jalankan daemon

sudo /etc/init.d/openerp-server start

CATATAN :

1. Beberapa langkah harus disesuaikan dengan kondisi instalasi. Perhatikan comment di /etc/init.d/openerp-server dan openerp-server.cfg.

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s