diff options
Diffstat (limited to 'linux/conf/rc.d')
-rwxr-xr-x | linux/conf/rc.d/distccd | 33 | ||||
-rwxr-xr-x | linux/conf/rc.d/fcgiwrap | 41 | ||||
-rwxr-xr-x | linux/conf/rc.d/git-daemon | 43 | ||||
-rw-r--r-- | linux/conf/rc.d/iptables | 22 | ||||
-rwxr-xr-x | linux/conf/rc.d/net | 54 | ||||
-rwxr-xr-x | linux/conf/rc.d/postgresql | 16 | ||||
-rwxr-xr-x | linux/conf/rc.d/wlan | 56 |
7 files changed, 265 insertions, 0 deletions
diff --git a/linux/conf/rc.d/distccd b/linux/conf/rc.d/distccd new file mode 100755 index 0000000..65a166d --- /dev/null +++ b/linux/conf/rc.d/distccd @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# +# /etc/rc.d/distccd: start/stop distcc daemon +# + +. /etc/distcc.conf +if [ -z "$DISTCC_ALLOW" ]; then + echo "Please define a range of IPs allowed to connect to this distccd" + echo "host in DISTCC_ALLOW in /etc/rc.conf. More detailed information" + echo "can be found in the distcc's README package." + exit 1 +fi + +DISTCC_USER="${DISTCC_USER:=nobody}" +DISTCC_LOG_LEVEL="${DISTCC_LOG_LEVEL:=notice}" + +case $1 in +start) + /usr/sbin/distccd --daemon --user "$DISTCC_USER" --allow "$DISTCC_ALLOW" --log-level "$DISTCC_LOG_LEVEL" + ;; +stop) + killall -q /usr/sbin/distccd + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/linux/conf/rc.d/fcgiwrap b/linux/conf/rc.d/fcgiwrap new file mode 100755 index 0000000..2059848 --- /dev/null +++ b/linux/conf/rc.d/fcgiwrap @@ -0,0 +1,41 @@ +#!/bin/sh +# +# /etc/rc.d/bird: start/stop fcgiwrapper +# + +SSD=/sbin/start-stop-daemon +NAME=fcgiwrap +PROG=/usr/bin/spawn-fcgi +USER=www +GROUP=gitolite +PIDFILE=/var/run/spawn_${NAME}.pid +SOCKET=/var/run/fcgiwrap.sock +OPTS="-u $USER -g $GROUP -P $PIDFILE -M 0660 -s $SOCKET -- /usr/sbin/${NAME}" + + +case $1 in + start) + echo "Starting ${NAME}..." + $SSD --background --user $USER --quiet --start --pidfile $PIDFILE --exec $PROG -- $OPTS + ;; +stop) + echo "Stopping ${NAME}..." + $SSD --stop --remove-pidfile --retry 10 --pidfile $PIDFILE + ;; +restart) + echo "Restarting ${NAME}..." + $0 stop + $0 start + ;; +status) + $SSD --status --pidfile $PIDFILE + case $? in + 0) echo "$PROG is running with pid $(cat $PIDFILE )" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac diff --git a/linux/conf/rc.d/git-daemon b/linux/conf/rc.d/git-daemon new file mode 100755 index 0000000..41793eb --- /dev/null +++ b/linux/conf/rc.d/git-daemon @@ -0,0 +1,43 @@ +#!/bin/sh + +SSD=/sbin/start-stop-daemon +NAME=git-daemon +PROG=$(git --exec-path)/${NAME} +USER=gitolite +GROUP=gitolite +PIDFILE=/var/run/git-daemon.pid +REPOS=/srv/gitolite/repositories +OPTS="--verbose --reuseaddr --base-path=${REPOS}" + +case $1 in + start) + echo "Starting ${NAME}..." + $SSD --start \ + --pidfile ${PIDFILE} \ + --exec ${PROG} -- ${OPTS} \ + --detach --pid-file=${PIDFILE} \ + --user=${USER} --group=${GROUP} + + ;; + stop) + echo "Stopping ${NAME}..." + $SSD --stop --quiet --name git-daemon \ + --pidfile ${PIDFILE} + ;; + restart) + echo "Restarting ${NAME}..." + $0 stop + $0 start + ;; + status) + $SSD --status --pidfile $PIDFILE + case $? in + 0) echo "$PROG is running with pid $(cat $PIDFILE )" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; + *) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac diff --git a/linux/conf/rc.d/iptables b/linux/conf/rc.d/iptables new file mode 100644 index 0000000..44f6bb2 --- /dev/null +++ b/linux/conf/rc.d/iptables @@ -0,0 +1,22 @@ +#!/bin/bash + +case $1 in + start) + echo "clear all iptables tables" + #nohup bash /etc/iptables/ipt-start.sh & + nohup bash /etc/iptables/ipt-start.sh & + ;; + stop) + echo "clear all iptables tables" + nohup bash /etc/iptables/ipt-stop.sh & + ;; + restart) + $0 start + ;; + status) + /usr/sbin/iptables -L -n -v + ;; + *) + echo "Usage: $0 [start|stop]" + ;; +esac diff --git a/linux/conf/rc.d/net b/linux/conf/rc.d/net new file mode 100755 index 0000000..a4c566a --- /dev/null +++ b/linux/conf/rc.d/net @@ -0,0 +1,54 @@ +#!/bin/sh +# +# /etc/rc.d/net: start/stop network interface +# + +# Connection type: "DHCP" or "static" +TYPE="DHCP" + +# For "static" connections, specify your settings here: +# To see your available devices run "ip link". +DEV=ens3 +ADDR=192.168.1.100 +MASK=24 +GW=192.168.1.1 + +# Optional settings: +DHCPOPTS="-t 10" + +/sbin/ifconfig dummy down > /dev/null 2>&1 +/sbin/ifconfig dummy0 down > /dev/null 2>&1 +/sbin/ifconfig ifb0 down > /dev/null 2>&1 +/sbin/ifconfig ifb1 down > /dev/null 2>&1 +/sbin/ifconfig bond0 down > /dev/null 2>&1 + +case $1 in + start) + if [ "${TYPE}" = "DHCP" ]; then + /sbin/dhcpcd ${DHCPOPTS} + else + /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast + + /sbin/ip link set ${DEV} up + /sbin/ip route add default via ${GW} + fi + ;; + stop) + if [ "${TYPE}" = "DHCP" ]; then + /sbin/dhcpcd -x + else + /sbin/ip route del default + /sbin/ip link set ${DEV} down + /sbin/ip addr del ${ADDR}/${MASK} dev ${DEV} + fi + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: $0 [start|stop|restart]" + ;; +esac + +# End of file + diff --git a/linux/conf/rc.d/postgresql b/linux/conf/rc.d/postgresql new file mode 100755 index 0000000..5f0762a --- /dev/null +++ b/linux/conf/rc.d/postgresql @@ -0,0 +1,16 @@ +# +# /etc/rc.d/postgresql: start, stop or restart PostgreSQL server postmaster +# + +PG_DATA=/srv/pgsql/data + +case "$1" in + start|stop|status|restart|reload) + sudo -u postgres pg_ctl -D "$PG_DATA" -l /var/log/postgresql "$1" + ;; + *) + echo "usage: $0 start|stop|restart|reload|status" + ;; +esac + +# End of file diff --git a/linux/conf/rc.d/wlan b/linux/conf/rc.d/wlan new file mode 100755 index 0000000..9a2f935 --- /dev/null +++ b/linux/conf/rc.d/wlan @@ -0,0 +1,56 @@ +#!/bin/sh +# +# /etc/rc.d/wlan: start/stop wireless interface +# + +DEV=wlp3s0 + + +SSD=/sbin/start-stop-daemon +PROG_DHCP=/sbin/dhcpcd +PROG_WIFI=/usr/sbin/wpa_supplicant +PID_DHCP=/var/run/dhcpcd.pid +PID_WIFI=/var/run/wpa_supplicant.pid + +OPTS_DHCP="--waitip -h $(/bin/hostname) -z $DEV" +OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV" + + +print_status() { + $SSD --status --pidfile $2 + case $? in + 0) echo "$1 is running with pid $(cat $2)" ;; + 1) echo "$1 is not running but the pid file $2 exists" ;; + 3) echo "$1 is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac +} + +case $1 in + start) + $SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI && \ + $SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP + RETVAL=$? + ;; + stop) + ( $SSD --stop --retry 10 --pidfile $PID_DHCP + $SSD --stop --retry 10 --pidfile $PID_WIFI ) + RETVAL=$? + ;; + restart) + $0 stop + $0 start + ;; + status) + print_status $PROG_WIFI $PID_WIFI + print_status $PROG_DHCP $PID_DHCP + ;; + *) + echo "Usage: $0 [start|stop|restart|status]" + ;; +esac + +exit $RETVAL + +# End of file + |