Archive for the ‘Linux’ Category

CentOS 6.2 and LXC

January 16th, 2013 No comments

Followed this recipe first, but got bogged down on the home-brew tools and very detailed guest config. However, this blog has the best description and config I’ve ever seen for bridge networking on CentOS – worked like a charm.
Finally got everything working with these (much simpler) instructions using a centos6 guest from the openvz template download site.

Categories: Linux Tags: , , , , , , , , ,

Example Linux chkconfig/init Script

March 18th, 2008 2 comments

From Cliff Pearson’s excellent system administration blog:

<<begin quote>>

From time to time, people want me to create LINUX init scripts for them. I usually just take an existing one for another service and change it up to work for my new application, but most of them have become so long these days that I end up having to hack out a ton of code just to reduce them down to the very basic script I need. I decided to create this very simple template so I wouldn’t have to keep trimming down the more complex scripts that one tends to find in /etc/init.d these days.

This script is chkconfig compatible, so call it the name of your new service and put it in /etc/init.d

The chkconfig: 235 section indicates the the default runlevels. For instance, if we called this script /etc/init.d/new-service and ran chkconfig new-service on, it would be active in runlevels 2,3 and 5.

The 98 and 55 numbers indicate the order of startup and kill. This means that using this tag, the startup symbolic link would be named S98new-service and the symbolic link to kill the process would be named K55new-service.

#### SNIP ####

#! /bin/sh
# Basic support for IRIX style chkconfig
# chkconfig: 235 98 55
# description: Manages the services you are controlling with the chkconfig command

case "$1" in
        echo -n "Starting new-service"
        #To run it as root:
        #Or to run it as some other user:
        /bin/su - username -c /path/to/command/to/start/new-service
        echo "."
        echo -n "Stopping new-service"
        #To run it as root:
        #Or to run it as some other user:
        /bin/su - username -c /path/to/command/to/stop/new-service
        echo "."

        echo "Usage: /sbin/service new-service {start|stop}"
        exit 1

exit 0

#### /SNIP ####

Obviously change all instances of “new-service” to the name of your actual service… Enjoy!

<< end quote >>