`
wuhuizhong
  • 浏览: 688739 次
  • 性别: Icon_minigender_1
  • 来自: 中山
社区版块
存档分类
最新评论

Instiki Redhat Init Script

    博客分类:
  • ROR
阅读更多

Here is a simple Redhat Linux-compatible (chkconfig) script that you can use to start and stop instiki, and also to make it startup when your system boots (chkconfig --add instiki).

Copy this and put it into a file called: /etc/init.d/instiki

#!/bin/bash
#
# instiki      Start/Stop Instiki.
#
# chkconfig: - 62 38
# description: Instiki is a ruby wiki.
#
# processname: instiki
#
# By: Ryan Dlugosz - ryan@dlugosz.net
#
# Based on freshclam init by:
# (c) 2004/05/17 Petr@Kristof.CZ under GNU GPL 2.0+
#
# Updated 4/16/2005 to accomodate instiki 0.10.0
#

# Source function library
. /etc/init.d/functions

# Get network config
. /etc/sysconfig/network

RETVAL=0

start() {
    echo -n $"Starting instiki: "
    # Start me up!
    daemon --user nobody /usr/local/bin/instiki/instiki --port=2500 --daemon --storage=/usr/local/bin/instiki/storage
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/instiki
    return $RETVAL
}

stop() {
    echo -n $"Stopping instiki: "
    killproc instiki
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/instiki
    return $RETVAL
}   

restart() {
      stop
    start
}   

reload() {
    stop
    start
}

case "$1" in
  start)
      start
    ;;
  stop)
      stop
    ;;
  status)
    status instiki
    ;;
  restart)
      restart
    ;;
  condrestart)
      [ -f /var/lock/subsys/instiki ] && restart || :
    ;;
  reload)
    reload
    ;;
  *)
    echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
    exit 1
esac

exit $?

Next, update the script to make sure your paths to the instiki script are correct. Finally, make the script executable (chmod +x instiki) and test it out (“service instiki start”, etc.). Oh yeah, and make sure your storage directory exists or at least can be created by Instiki itself.

I guess the storage parameter is no longer needed now that Instiki uses Active Record?
Debian Init Script

#! /bin/sh
#
# instiki WEBrick wiki server
#
# Based on:
#
# skeleton    example file to build /etc/init.d/ scripts.
#        This file should be used to construct scripts for /etc/init.d.
#
#        Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#        Modified for Debian GNU/Linux
#        by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#        Instiki modifications by Ben Armstrong <synrg@debian.org>.
#
# Version:    @(#)skeleton  1.9.1  08-Apr-2002  miquels@cistron.nl
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/instiki/instiki
NAME="instiki"
DESC="Instiki WEBrick server"

test -x $DAEMON || exit 0

set -e

USER=instiki
NICE=0

LOGDIR=/var/log/instiki
LOG=$LOGDIR/instiki.log

mkdir -p $LOGDIR
touch $LOG
chown -R $USER $LOGDIR

HOME=`grep $USER /etc/passwd | cut -d: -f6`
STORAGEDIR="$HOME/storage"
ARGS="--daemon --storage $STORAGEDIR"

case "$1" in
  start)
    echo -n "Starting $DESC: $NAME"
    # FIXME: not good to discard error output
        HOME="$HOME" INSTIKILOG="$LOG" start-stop-daemon --start --background \
        --user $USER --chuid $USER --nicelevel $NICE \
        --startas $DAEMON -- $ARGS >/dev/null 2>&1
    echo "."
    ;;
  stop)
    echo -n "Stopping $DESC: $NAME"
        start-stop-daemon --stop --user $USER
    echo "."
    ;;
  restart|force-reload)
    echo -n "Restarting $DESC: $NAME"
    # FIXME: not good to discard error output
        start-stop-daemon --oknodo --stop --user $USER
        HOME="$HOME" INSTIKILOG="$LOG" start-stop-daemon --start \
        --user $USER --chuid $USER --nicelevel $NICE \
        --startas $DAEMON -- $ARGS >/dev/null 2>&1
    echo "."
    ;;
  *)
    N=/etc/init.d/$NAME
    # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

分享到:
评论

相关推荐

    redhat6升级到redhat7,过程redhat6.x-> redhat6.10->rehat7.9 主版本最高版本

    mod_wsgi-3.2-7.el6.x86_64.rpm apr-util-ldap-1.3.9-3....redhat-rpm-config-9.0.3-51.el6.noarch.rpm openscap-utils-1.2.13-2.el6.x86_64.rpm openscap-scanner-1.2.13-2.el6.x86_64.rpm fakeroot-1.12.2-22.2.el6.

    RedHat7.3百度云下载链接

    RedHat7.3百度云下载链接

    Redhat6.5 Redhat6.5虚拟机镜像

    RedHat6.5的linux虚拟机,包含切换屏幕插件。亲测,可用

    Redhat6.6/Redhat6.7 docker 离线安装依赖包

    Redhat6.6/Redhat6.7 docker 离线安装依赖包

    RedHat虚拟ISO下载地址

    根据提供的文件信息,本文将详细解析与“RedHat虚拟ISO下载地址”相关的知识点,包括RedHat Linux的基本介绍、ISO镜像文件的概念、选择合适版本的重要性以及如何安全地下载RedHat Linux ISO镜像等内容。 ### 一、...

    redhat 7.9.txt

    Redhat7.9系统下载

    Redhat的rescue修复模式

    ### Redhat的Rescue修复模式详解 #### 一、引言 在Redhat Linux系统中,Rescue修复模式是一种非常重要的故障恢复工具。当系统由于各种原因无法正常启动时,可以通过Rescue模式来修复系统问题,使系统恢复正常运行。...

    redhat_安装

    RedHat 安装指南 RedHat 安装是 Linux 新手入门的不二之选,下面我们将详细讲解 RedHat 安装的准备工作、安装方式和安装步骤。 安装前的准备 在安装 RedHat 之前,需要检查硬件是否支持 Linux。幸好,Linux 目前...

    RedHat6.rar

    redhat6 安装、配置、管理及虚拟化等官方手册,欢迎下载。

    openssh 8.9p1_redhat 7.9.rar

    《OpenSSH 8.9p1 RPM安装包在Redhat 7.x系统中的应用与配置详解》 OpenSSH,全称Open Source Secure Shell,是一款开源的SSH(Secure Shell)协议实现,广泛应用于Linux和Unix系统中,提供安全的远程登录、文件传输...

    Redhat搭建HA双机环境

    ### Redhat搭建HA双机环境知识点详解 #### 一、HA双机环境概念与意义 高可用性(High Availability,简称HA)是指通过特定的技术手段确保系统能够长时间地提供服务,即使是在出现故障的情况下也能自动恢复,从而...

    最新版redhat6.10

    最新版redhat6.10官方原版镜像,Red Hat Enterprise Linux 6.10,绝对官方原版,正式版

    linux redhat8.4.txt

    linux redhat8.4

    RedHat 9.0 帮助文档

    RedHat 9.0是历史悠久且备受赞誉的Linux操作系统版本之一,它为用户提供了稳定、安全和高效的计算环境。这个“RedHat 9.0帮助文档”包含了丰富的资源,旨在帮助用户更好地理解和操作这一系统,尤其对Linux初学者来说...

    redhat linux9.0系统下载

    - 第一张 CD:`ftp://ftp.dc.aleron.net/pub/linux/redhat/ftp.redhat.com/linux/9/en/iso/i386/shrike-i386-disc1.iso` - 第二张 CD:`ftp://ftp.dc.aleron.net/pub/linux/redhat/ftp.redhat....

    redhat7可用yum安装包和yum源

    redhat7可用yum安装包和yum源

    redhat9 nvidia 显卡驱动安装

    - 使用终端命令 `/sbin/init 3` 进入多用户文本模式。如果此操作没有生效,可以通过点击“注销”按钮并重新登录来进入文本模式。 #### 安装过程 1. **切换到root用户**: - 在文本模式下登录到root账户,以便...

    RedHat最新版本7.6下载

    Redhat 最新版本7.6下载,Linux镜像文件,用于研发和生成都适用

    RedHat7.0百度云下载链接

    RedHat7.0百度云下载链接

Global site tag (gtag.js) - Google Analytics