Skip to content

BASH - Linux Service Initialization Skeleton Script for Creating Custom Init.d Scripts

Notifications You must be signed in to change notification settings

bonusbits/initd_script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Generic Linux Init.d Initialization Script

Description

This script is a starting point for those packages that don't come with initialization script that you want to run as a daemon.

Prerequisites

  1. CentOS/RHEL <= 6.x
    • Linux systems that use init.d and not systemd (CentOS/RHEL 7)

Usage

  1. Clone to system from Github.
    git clone https://github.com/bonusbits/initd_script.git /path/to/clone/
  2. Copy script to init.d
    sudo cp /path/to/clone/initd_script.sh /etc/init.d/myserviced
  3. Make script executable
    sudo chmod +x /etc/init.d/myserviced
  4. Edit Custom Variables
    sudo vim /etc/init.d/myserviced
    # region Edit These Variables
    servicename=myserviced
    binary=/bin/bash
    script=/opt/application/runscript.sh
    logfile=/var/log/myserviced/myserviced.log
    pidfile=/var/run/myserviced/myserviced.pid
    user=myservice
    # endregion Edit These Variables
  5. Add to Chkconfig
    sudo chkconfig --add myserviced

About

BASH - Linux Service Initialization Skeleton Script for Creating Custom Init.d Scripts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages