DNETC System V init Script

This week I was looking into init scripts again, its been a while… Anyhow, I remembered that I had written one for distributed.net’s client app.

I thought I would share it, place in “/etc/init.d/dnetc”. It should work fine on current releases of Fedora, RHEL and CentOS. Its designed for the sysadmin to configure dnetc for that system and then manage its start up and shutdown. (Not a script for end users to be using. )

You will need to change the application path to be the directory you have extracted the into.

#!/bin/bash
#
# dnetc This shell script takes care of starting and stopping distributed.net client
#
# chkconfig: 345 90 12
# description: distributed.net client program, a \
# distributed computing project. The program \
# uses only the computers idle time.
# processname: dnetc

# config: /etc/dnetc/dnetc.ini
# pidfile: /var/run/dnetc.pid

# Get function from functions library
. /etc/init.d/functions

start() {
echo -n "Starting DNET client: "
/custom/dnetc/dnetc -quiet
touch /var/lock/subsys/dnetc
success $"DNET client startup"
echo
}

stop() {
echo -n "Stopping DNET client: "
killproc dnetc
rm -f /var/lock/subsys/dnetc
echo
}

# —————————————————————–
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status dnetc
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0

This script could do with some more work, I did put it together quickly, but this page helped me get it going and its worth looking at if you want to write a System V init script of your own.

(Visited 139 times, 1 visits today)
Facebooktwittergoogle_plusredditpinterestlinkedinmail

One Comment

  1. Pingback: distributed.net client RPM Package « JERVIS DOT WS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.