Skip to content
Snippets Groups Projects
Commit d32a0c62 authored by buildslave's avatar buildslave
Browse files

Porting init.d scripts to CentOS(5-6).

TODO: Fedora 19,20,rawhide, CentOS 7 Uses systemd.
parent d834c67a
No related merge requests found
extra/dist/default/tarantool /etc/default
extra/dist/default.deb/tarantool /etc/default
extra/dist/dist.lua /usr/lib/tarantool
#! /bin/sh
# /etc/init.d/tarantool
### BEGIN INIT INFO
# Provides: tarantool
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Tarantool init script
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Author: Dmitry E. Oboukhov <unera@debian.org>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
CONF_DIR=/etc/tarantool/instances.enabled
SCRIPTNAME=/etc/init.d/tarantool
DAEMON=/usr/bin/tarantool
INSTANCES=`find $CONF_DIR -xtype f -name '*lua'`
DIST_LUA=/usr/lib/tarantool/dist.lua
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
. /lib/init/vars.sh
if test -z "$INSTANCES"; then
echo "tarantool: There are no instances (*.lua) in $CONF_DIR"
exit 0
fi
#
# Function that starts the daemon/service
#
do_start() {
echo "tarantool: Starting instances"
for inst in $INSTANCES; do
$DAEMON $DIST_LUA start `basename $inst .lua`
done
return 0
}
#
# Function that stops the daemon/service
#
do_stop() {
echo "tarantool: Stopping instances"
for inst in $INSTANCES; do
$DAEMON $DIST_LUA stop `basename $inst .lua`
done
return 0
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
do_stop
do_start
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
status)
;;
restart|force-reload)
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:
../extra/dist/tarantool
\ No newline at end of file
......@@ -3,11 +3,21 @@
#
if (ENABLE_RPM)
# chmod +x 655
# install (FILES tarantool DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/init.d
# PERMISSIONS
# OWNER_READ OWNER_WRITE
# GROUP_READ GROUP_EXECUTE
# WORLD_READ WORLD_EXECUTE)
install (FILES dist/tarantool DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/init.d/
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
install (FILES dist/default.rpm/tarantool DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/sysconfig/
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
install (FILES dist/dist.lua DESTINATION ${CMAKE_INSTALL_LIBDIR}/tarantool/
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
# # chmod +x 755
# install (FILES tarantool_multi.sh DESTINATION bin
# PERMISSIONS
......
# Options for Tarantool
SNAPS=/var/lib/tarantool
XLOGS=/var/lib/tarantool
LOGS=/var/log/tarantool
PIDS=/var/pid/tarantool
USERNAME=tarantool
INSTDIR=/etc/tarantool/instances.enabled
# vim: set ft=sh :
# Options for Tarantool
SNAPS=/var/lib/tarantool
XLOGS=/var/lib/tarantool
LOGS=/var/log/tarantool
PIDS=/var/pid/tarantool
USERNAME=tarantool
INSTDIR=/etc/tarantool/instances.enabled
# vim: set ft=sh :
#!env tarantool
local DEFAULTS = '/etc/default/tarantool'
local DEFAULT_CFG = {
PIDS = '/var/pid/tarantool',
SNAPS = '/var/lib/tarantool',
XLOGS = '/var/lib/tarantool',
LOGS = '/var/log/tarantool',
USERNAME = 'tarantool',
INSTDIR = '/etc/tarantool/instances.enabled',
}
if os.getenv('TARANTOOL_DEFAULTS') ~= nil then
local nd = os.getenv('TARANTOOL_DEFAULTS')
if #nd then
DEFAULTS = nd
end
end
local fio = require 'fio'
local log = require 'log'
local errno = require 'errno'
......@@ -27,6 +10,19 @@ local ffi = require 'ffi'
ffi.cdef[[ int kill(int pid, int sig); ]]
local DEFAULTS = '/etc/sysconfig/tarantool'
local DEFAULT_CFG = {
PIDS = '/var/pid/tarantool',
SNAPS = '/var/lib/tarantool',
XLOGS = '/var/lib/tarantool',
LOGS = '/var/log/tarantool',
USERNAME = 'tarantool',
INSTDIR = '/etc/tarantool/instances.enabled',
}
if fio.stat(DEFAULTS) == nil then
DEFAULTS = '/etc/default/tarantool'
end
function read_cfg(name)
if name == nil then
......
#! /bin/sh
# /etc/init.d/tarantool
### BEGIN INIT INFO
# Provides: tarantool
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Tarantool init script
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Author: Dmitry E. Oboukhov <unera@debian.org>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
CONF_DIR=/etc/tarantool/instances.enabled
SCRIPTNAME=/etc/init.d/tarantool
DAEMON=/usr/bin/tarantool
INSTANCES=`find $CONF_DIR -xtype f -name '*lua'`
DIST_LUA=/usr/lib/tarantool/dist.lua
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
if test -z "$INSTANCES"; then
echo "tarantool: There are no instances (*.lua) in $CONF_DIR"
exit 0
fi
#
# Function that starts the daemon/service
#
do_start() {
echo "tarantool: Starting instances"
for inst in $INSTANCES; do
$DAEMON $DIST_LUA start `basename $inst .lua`
done
return 0
}
#
# Function that stops the daemon/service
#
do_stop() {
echo "tarantool: Stopping instances"
for inst in $INSTANCES; do
$DAEMON $DIST_LUA stop `basename $inst .lua`
done
return 0
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
do_stop
do_start
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
status)
;;
restart|force-reload)
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:
......@@ -40,7 +40,7 @@ Name: %{?scl_prefix}tarantool
Version: @RPM_PACKAGE_VERSION@
Release: @RPM_PACKAGE_RELEASE@
Group: Applications/Databases
Summary: Tarantool - an efficient in-memory data store
Summary: Tarantool - an efficient in-memory data storage
Vendor: tarantool.org
License: BSD
Requires: readline
......@@ -173,11 +173,16 @@ tarantool-sql-module.
print(wrap_with_toolset('make %{?_smp_mflags}\n'))
}
%install
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/tarantool/instances.enabled
make DESTDIR=%{buildroot} install
%post
chkconfig tarantool on
service tarantool start
%preun
service tarantool stop
chkconfig tarantool off
%files
%defattr(-,root,root,-)
......@@ -188,8 +193,17 @@ make DESTDIR=%{buildroot} install
"%{_datadir}/doc/tarantool/README.md"
"%{_datadir}/doc/tarantool/LICENSE"
"%{_datadir}/doc/tarantool/box-protocol.txt"
"%{_mandir}/man1/tarantool.1.gz"
"%{_sysconfdir}/sysconfig/tarantool"
"%{_sysconfdir}/init.d/tarantool"
%dir "%{_sysconfdir}/tarantool"
%dir "%{_sysconfdir}/tarantool/instances.enabled"
%dir "%{_libdir}/tarantool/"
"%{_libdir}/tarantool/dist.lua"
%files sql-module
%defattr(-,root,root,-)
%dir "%{_datadir}/tarantool"
......@@ -200,7 +214,6 @@ make DESTDIR=%{buildroot} install
%if %{with postgresql}
%files pg-module
%defattr(-,root,root,-)
%dir "%{_libdir}/tarantool/"
%dir "%{_libdir}/tarantool/box"
"%{_libdir}/tarantool/box/net/pg.so"
%endif
......@@ -208,7 +221,6 @@ make DESTDIR=%{buildroot} install
%if %{with mysql}
%files mysql-module
%defattr(-,root,root,-)
%dir "%{_libdir}/tarantool"
%dir "%{_libdir}/tarantool/box"
"%{_libdir}/tarantool/box/net/mysql.so"
%endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment