init-script-template

A template for simple System V init scripts

Github星跟踪图

System V init script template

A simple template for init scripts that provide the start, stop,
restart and status commands.

Handy for Node.js apps and everything
else that runs itself.

Getting started

Copy template to /etc/init.d and rename it to something
meaningful. Then edit the script and enter that name after Provides:
(between ### BEGIN INIT INFO and ### END INIT INFO).

Now set the following three variables in the script:

dir

The working directory of your process.

cmd

The command line to start the process.

user

The user that should execute the command (optional).
If not set, the command will be called as root (via sudo ...).

Here's an example for an app called
algorithms:

dir="/var/apps/algorithms"
cmd="node server.js"
user="node"

Script usage

Start

Starts the app.

/etc/init.d/algorithms start

Stop

Stops the app.

/etc/init.d/algorithms stop

Restart

Restarts the app.

/etc/init.d/algorithms restart

Status

Tells you whether the app is running. Exits with 0 if it is and 1
otherwise.

/etc/init.d/algorithms status

Logging

By default, standard output goes to /var/log/scriptname.log and
error output to /var/log/scriptname.err. If you're not happy with
that, change the variables stdout_log and stderr_log.

License

Copyright (C) 2012-2014 Felix H. Dahlke

This is open source software, licensed under the MIT License. See the
file LICENSE for details.

主要指标

概览
名称与所有者fhd/init-script-template
主编程语言Shell
编程语言Shell (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2012-03-08 06:50:31
推送于2022-02-11 17:51:55
最后一次提交2017-06-02 10:15:41
发布数0
用户参与
星数1.1k
关注者数40
派生数313
提交数22
已启用问题?
问题数9
打开的问题数8
拉请求数7
打开的拉请求数6
关闭的拉请求数5
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?