Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Create A UNIX Init.d Startup Script With Ruby

DZone's Guide to

Create A UNIX Init.d Startup Script With Ruby

·
Free Resource

#!/usr/bin/env ruby
#
# app_name      This is a startup script for use in /etc/init.d
#
# chkconfig:    2345 80 20
# description:  Description of program / service

APP_NAME = 'app_name'

case ARGV.first
	when 'status':
    	status = 'stopped'
        puts "#{APP_NAME} is #{status}"
	when 'start':
		# Do your thang
    when 'stop':
		# Do your thang
	when 'restart':
		# Do your thang		
end

unless %w{start stop restart status}.include? ARGV.first
        puts "Usage: #{APP_NAME} {start|stop|restart}"
        exit
end
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}