From 4afb848e3a54eb469ce2a43ac0e746cfa725273c Mon Sep 17 00:00:00 2001 From: milisarge Date: Fri, 14 Jul 2017 14:54:29 +0300 Subject: [PATCH] servis_kontrol --- ayarlar/servisler/mbd/init.d/bumblebeed | 36 ++++ ayarlar/servisler/mbd/init.d/cjdns | 165 ++++++++++++++++ ayarlar/servisler/mbd/init.d/halt | 39 ++++ ayarlar/servisler/mbd/init.d/init_single | 37 ++++ ayarlar/servisler/mbd/init.d/localnet | 70 +++++++ ayarlar/servisler/mbd/init.d/modules | 82 ++++++++ ayarlar/servisler/mbd/init.d/network | 52 +++++ ayarlar/servisler/mbd/init.d/openvpn | 65 +++++++ ayarlar/servisler/mbd/init.d/random | 2 +- ayarlar/servisler/mbd/init.d/rc | 229 +++++++++++++++++++++++ ayarlar/servisler/mbd/init.d/reboot | 43 +++++ ayarlar/servisler/mbd/init.d/sendsignals | 66 +++++++ ayarlar/servisler/mbd/init.d/setclock | 63 +++++++ ayarlar/servisler/mbd/init.d/squid | 42 +++++ ayarlar/servisler/mbd/init.d/sysklogd | 101 ++++++++++ ayarlar/servisler/mbd/init.d/template | 55 ++++++ ayarlar/servisler/mbd/init.d/yacy | 37 ++++ 17 files changed, 1183 insertions(+), 1 deletion(-) create mode 100755 ayarlar/servisler/mbd/init.d/bumblebeed create mode 100755 ayarlar/servisler/mbd/init.d/cjdns create mode 100755 ayarlar/servisler/mbd/init.d/halt create mode 100755 ayarlar/servisler/mbd/init.d/init_single create mode 100755 ayarlar/servisler/mbd/init.d/localnet create mode 100755 ayarlar/servisler/mbd/init.d/modules create mode 100755 ayarlar/servisler/mbd/init.d/network create mode 100755 ayarlar/servisler/mbd/init.d/openvpn mode change 100644 => 100755 ayarlar/servisler/mbd/init.d/random create mode 100755 ayarlar/servisler/mbd/init.d/rc create mode 100755 ayarlar/servisler/mbd/init.d/reboot create mode 100755 ayarlar/servisler/mbd/init.d/sendsignals create mode 100755 ayarlar/servisler/mbd/init.d/setclock create mode 100755 ayarlar/servisler/mbd/init.d/squid create mode 100755 ayarlar/servisler/mbd/init.d/sysklogd create mode 100755 ayarlar/servisler/mbd/init.d/template create mode 100644 ayarlar/servisler/mbd/init.d/yacy diff --git a/ayarlar/servisler/mbd/init.d/bumblebeed b/ayarlar/servisler/mbd/init.d/bumblebeed new file mode 100755 index 000000000..29571ca5d --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/bumblebeed @@ -0,0 +1,36 @@ +#!/bin/sh +# +# /etc/rc.d/bumblebeed: start/stop bumblebeed +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/bumblebeed +OPTS="--daemon" + +case $1 in +start) + $SSD --start --exec $PROG -- $OPTS + ;; +stop) + $SSD --stop --retry 10 --exec $PROG + ;; +restart) + $0 stop + sleep 1 + $0 start + ;; +status) + $SSD --status --exec $PROG + case $? in + 0) echo "$PROG is running with pid $(pidof $PROG)" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac + +# End of file diff --git a/ayarlar/servisler/mbd/init.d/cjdns b/ayarlar/servisler/mbd/init.d/cjdns new file mode 100755 index 000000000..996953a27 --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/cjdns @@ -0,0 +1,165 @@ +#!/usr/bin/env bash + +# This script is licensed under the GPL2 and includes modified content from the GPL2 licensed /etc/rc.d/functions script that used to be included in Archlinux + +### Modified selection from the now deprecated /etc/rc.d/functions ### +calc_columns () { + STAT_COL=80 + if [[ ! -t 1 ]]; then + USECOLOR="" + elif [[ -t 0 ]]; then + # stty will fail when stdin isn't a terminal + STAT_COL=$(stty size) + # stty gives "rows cols"; strip the rows number, we just want columns + STAT_COL=${STAT_COL##* } + elif tput cols &>/dev/null; then + # is /usr/share/terminfo already mounted, and TERM recognized? + STAT_COL=$(tput cols) + fi + if (( STAT_COL == 0 )); then + # if output was 0 (serial console), set default width to 80 + STAT_COL=80 + USECOLOR="" + fi + + # we use 13 characters for our own stuff + STAT_COL=$(( STAT_COL - 13 )) + + if [[ -t 1 ]]; then + SAVE_POSITION="\e[s" + RESTORE_POSITION="\e[u" + DEL_TEXT="\e[$(( STAT_COL + 4 ))G" + else + SAVE_POSITION="" + RESTORE_POSITION="" + DEL_TEXT="" + fi +} + +calc_columns + +# disable colors on broken terminals +TERM_COLORS=$(tput colors 2>/dev/null) +if (( $? != 3 )); then + case $TERM_COLORS in + *[!0-9]*) USECOLOR="";; + [0-7]) USECOLOR="";; + '') USECOLOR="";; + esac +fi +unset TERM_COLORS + +deltext() { + printf "${DEL_TEXT}" +} + +stat_busy() { + printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} " + printf "${SAVE_POSITION}" + deltext + printf " ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} " +} + +stat_done() { + deltext + printf " ${C_OTHER}[${C_DONE}DONE${C_OTHER}]${C_CLEAR} \n" +} + +stat_fail() { + deltext + printf " ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n" +} + +status_started() { + deltext + echo -ne "$C_OTHER[${C_STRT}STARTED$C_OTHER]$C_CLEAR " +} + +status_stopped() { + deltext + echo -ne "$C_OTHER[${C_STRT}STOPPED$C_OTHER]$C_CLEAR " +} + +# Return PID of $1 +get_pid() { + pidof -o %PPID $1 || return 1 +} + +# set colors +if [[ $USECOLOR != [nN][oO] ]]; then + if tput setaf 0 &>/dev/null; then + C_CLEAR=$(tput sgr0) # clear text + C_MAIN=${C_CLEAR}$(tput bold) # main text + C_OTHER=${C_MAIN}$(tput setaf 4) # prefix & brackets + C_SEPARATOR=${C_MAIN}$(tput setaf 0) # separator + C_BUSY=${C_CLEAR}$(tput setaf 6) # busy + C_FAIL=${C_MAIN}$(tput setaf 1) # failed + C_DONE=${C_MAIN} # completed + C_BKGD=${C_MAIN}$(tput setaf 5) # backgrounded + C_H1=${C_MAIN} # highlight text 1 + C_H2=${C_MAIN}$(tput setaf 6) # highlight text 2 + else + C_CLEAR="\e[m" # clear text + C_MAIN="\e[;1m" # main text + C_OTHER="\e[1;34m" # prefix & brackets + C_SEPARATOR="\e[1;30m" # separator + C_BUSY="\e[;36m" # busy + C_FAIL="\e[1;31m" # failed + C_DONE=${C_MAIN} # completed + C_BKGD="\e[1;35m" # backgrounded + C_H1=${C_MAIN} # highlight text 1 + C_H2="\e[1;36m" # highlight text 2 + fi +fi + +PREFIX_REG="::" + +### CJDNS service ### +. /etc/default/cjdns + +PID=$(get_pid $CJDROUTE) + +case "$1" in + start) + stat_busy "Starting cjdns" + + #START CJDNS AND ENABLE THE DAEMON IF IT SUCCEEDS + if [ -z "$PID" ]; then + cjdns.sh start &> /dev/null + if [ $? -gt 0 ]; then + stat_busy "Unable to start the daemon" + stat_fail + exit 1 + else + stat_done + fi + else + stat_busy "The daemon is already running" + stat_fail + exit 1 + fi + ;; + stop) + stat_busy "Stopping cjdns" + cjdns.sh stop + if [ $? -gt 0 ]; then + stat_busy "The daemon was not running" + stat_fail + else + stat_done + fi + ;; + restart) + $0 stop + while [ ! -z "$PID" -a -d "/proc/$PID" ]; do sleep 1; done + $0 start + ;; + status) + stat_busy "The daemon is currently..." + if [ $(cjdns.sh status | grep -c not) = 0 ]; then status_started; else status_stopped; fi + ;; + *) + echo "usage: $0 {start|stop|restart|status}" +esac + +exit 0 diff --git a/ayarlar/servisler/mbd/init.d/halt b/ayarlar/servisler/mbd/init.d/halt new file mode 100755 index 000000000..f8bfc70c2 --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/halt @@ -0,0 +1,39 @@ +#!/bin/sh +######################################################################## +# Begin halt +# +# Description : Halt Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: halt +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: 0 +# Default-Stop: +# Short-Description: Halts the system. +# Description: Halts the System. +# X-LFS-Provided-By: LFS +### END INIT INFO + +case "${1}" in + stop) + halt -d -f -i -p + ;; + + *) + echo "Usage: {stop}" + exit 1 + ;; +esac + +# End halt diff --git a/ayarlar/servisler/mbd/init.d/init_single b/ayarlar/servisler/mbd/init.d/init_single new file mode 100755 index 000000000..950e01f21 --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/init_single @@ -0,0 +1,37 @@ +#!/bin/sh + +. /lib/lsb/init-functions + +case ${1} in + start) + do_mount_virtualfs || exit 1 + do_load_modules || exit 1 + do_start_udev || exit 1 + do_start_checkfs || exit 1 + do_start_mountfs || exit 1 + do_start_localnet + #milis-kur + do_start_clock || exit 1 + do_start_cleanfs || exit 1 + do_start_udev_retry || exit 1 + do_start_swap || exit 1 + do_start_console || exit 1 + do_start_sysctl || exit 1 + bolumleri_bagla || exit 1 + log_info_msg "klavye ayarlari eklendi..." + klavye_ayar || exit 1 + ;; + stop) + do_stop_clock + do_stop_swap + do_stop_network + do_stop_mountfs + do_stop_localnet + ;; + *) + echo "Usage: ${0} {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/ayarlar/servisler/mbd/init.d/localnet b/ayarlar/servisler/mbd/init.d/localnet new file mode 100755 index 000000000..4b85a987f --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/localnet @@ -0,0 +1,70 @@ +#!/bin/sh +######################################################################## +# Begin localnet +# +# Description : Loopback device +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: localnet +# Required-Start: $local_fs +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Starts the local network. +# Description: Sets the hostname of the machine and starts the +# loopback interface. +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions +[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network +[ -r /etc/hostname ] && HOSTNAME=`cat /etc/hostname` + +case "${1}" in + start) + log_info_msg "Bringing up the loopback interface..." + ip addr add 127.0.0.1/8 label lo dev lo + ip link set lo up + evaluate_retval + + log_info_msg "Setting hostname to ${HOSTNAME}..." + hostname ${HOSTNAME} + evaluate_retval + ;; + + stop) + log_info_msg "Bringing down the loopback interface..." + ip link set lo down + evaluate_retval + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + echo "Hostname is: $(hostname)" + ip link show lo + ;; + + *) + echo "Usage: ${0} {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 + +# End localnet diff --git a/ayarlar/servisler/mbd/init.d/modules b/ayarlar/servisler/mbd/init.d/modules new file mode 100755 index 000000000..cab5cfadd --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/modules @@ -0,0 +1,82 @@ +#!/bin/sh +######################################################################## +# Begin modules +# +# Description : Module auto-loading script +# +# Authors : Zack Winkles +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: modules +# Required-Start: mountvirtfs sysctl +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Loads required modules. +# Description: Loads modules listed in /etc/sysconfig/modules. +# X-LFS-Provided-By: LFS +### END INIT INFO + +# Assure that the kernel has module support. +[ -e /proc/modules ] || exit 0 + +. /lib/lsb/init-functions + +case "${1}" in + start) + # Exit if there's no modules file or there are no + # valid entries + [ -r /etc/sysconfig/modules ] || exit 0 + egrep -qv '^($|#)' /etc/sysconfig/modules || exit 0 + + log_info_msg "Loading modules:" + + # Only try to load modules if the user has actually given us + # some modules to load. + + while read module args; do + + # Ignore comments and blank lines. + case "$module" in + ""|"#"*) continue ;; + esac + + # Attempt to load the module, passing any arguments provided. + modprobe ${module} ${args} >/dev/null + + # Print the module name if successful, otherwise take note. + if [ $? -eq 0 ]; then + log_info_msg2 " ${module}" + else + failedmod="${failedmod} ${module}" + fi + done < /etc/sysconfig/modules + + # Print a message about successfully loaded modules on the correct line. + log_success_msg2 + + # Print a failure message with a list of any modules that + # may have failed to load. + if [ -n "${failedmod}" ]; then + log_failure_msg "Failed to load modules:${failedmod}" + exit 1 + fi + ;; + + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +exit 0 + +# End modules diff --git a/ayarlar/servisler/mbd/init.d/network b/ayarlar/servisler/mbd/init.d/network new file mode 100755 index 000000000..75d1d590f --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/network @@ -0,0 +1,52 @@ +#!/bin/sh +######################################################################## +# Begin network +# +# Description : Network Control Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: $network +# Required-Start: $local_fs swap localnet +# Should-Start: $syslog +# Required-Stop: $local_fs swap localnet +# Should-Stop: $syslog +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Starts and configures network interfaces. +# Description: Starts and configures network interfaces. +# X-LFS-Provided-By: LFS +### END INIT INFO +. /lib/lsb/init-functions + +case "${1}" in + start) + do_start_network + ;; + stop) + do_stop_network + ;; + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; +esac + +exit 0 + +# End network diff --git a/ayarlar/servisler/mbd/init.d/openvpn b/ayarlar/servisler/mbd/init.d/openvpn new file mode 100755 index 000000000..62ce72f0f --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/openvpn @@ -0,0 +1,65 @@ +#!/bin/sh +# +# /etc/rc.d/openvpn: start/stop openvpn daemon +# + +CONFDIR=/etc/openvpn +RUNDIR=/var/run + +# optional arguments to openvpn +OPTARGS="--fast-io" + +usage() { + echo "Usage: $0 [start|stop|restart] " + exit 0 +} + +# require a config name to be specified +if [ -z "$2" ] +then + usage +fi + +CONF=${CONFDIR}/${2}.conf +PID=${RUNDIR}/openvpn.${2}.pid + +# check for the existence of the specified config +if [ ! -f ${CONF} ] +then + echo "Can't find config file ${CONF}! Exiting." + exit 1 +fi + +case $1 in + start) + # check for an existing PID; this tunnel may already be running + if [ -f ${PID} ] + then + echo "VPN '${2}' appears to be running already. If not, remove the stale PID file '${PID}'. Exiting." + exit 2 + fi + # start the specified VPN config + echo "Starting VPN '${2}'..." + /usr/sbin/openvpn --config ${CONF} --writepid ${PID} --daemon ovpn-${2} ${OPTARGS} + ;; + stop) + # check for an existing PID; this tunnel should already be running + if [ ! -f ${PID} ] + then + echo "VPN '${2}' doesn't appear to be running. Exiting." + exit 3 + fi + # stop the specified VPN config + echo "Stopping VPN '${2}'..." + kill `cat ${PID}` + rm -f ${PID} + ;; + restart) + ${0} stop ${2}; sleep 3; ${0} start ${2} + ;; + *) + usage + ;; +esac + +# End of file diff --git a/ayarlar/servisler/mbd/init.d/random b/ayarlar/servisler/mbd/init.d/random old mode 100644 new mode 100755 index f2fb495a7..b2f57ebde --- a/ayarlar/servisler/mbd/init.d/random +++ b/ayarlar/servisler/mbd/init.d/random @@ -26,7 +26,7 @@ . /lib/lsb/init-functions #$LastChangedBy: bdubbs $ -#$Date: 2011-12-05 23:56:33 -0600 (Mon, 05 Dec 2011) $ +#$Date: 2011-12-06 05:56:33 +0000 (Tue, 06 Dec 2011) $ case "$1" in start) diff --git a/ayarlar/servisler/mbd/init.d/rc b/ayarlar/servisler/mbd/init.d/rc new file mode 100755 index 000000000..003f5e57b --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/rc @@ -0,0 +1,229 @@ +#!/bin/bash +######################################################################## +# Begin rc +# +# Description : Main Run Level Control Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# : DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +. /lib/lsb/init-functions + +print_error_msg() +{ + log_failure_msg + # $i is set when called + MSG="FAILURE:\n\nYou should not be reading this error message.\n\n" + MSG="${MSG}It means that an unforeseen error took place in\n" + MSG="${MSG}${i},\n" + MSG="${MSG}which exited with a return value of ${error_value}.\n" + + MSG="${MSG}If you're able to track this error down to a bug in one of\n" + MSG="${MSG}the files provided by the files provided by\n" + MSG="${MSG}the ${DISTRO_MINI} distribution, please be so kind to inform us at\n" + MSG="${MSG}${DISTRO_CONTACT}.\n" + log_failure_msg "${MSG}" + + log_info_msg "Press Enter to continue..." + wait_for_user +} + +check_script_status() +{ + # $i is set when called + if [ ! -f ${i} ]; then + log_warning_msg "${i} is not a valid symlink." + continue + fi + + if [ ! -x ${i} ]; then + log_warning_msg "${i} is not executable, skipping." + continue + fi +} + +run() +{ + if [ -z $interactive ]; then + ${1} ${2} + return $? + fi + + while true; do + read -p "Run ${1} ${2} (Yes/no/continue)? " -n 1 runit + echo + + case ${runit} in + c | C) + interactive="" + ${i} ${2} + ret=${?} + break; + ;; + + n | N) + return 0 + ;; + + y | Y) + ${i} ${2} + ret=${?} + break + ;; + esac + done + + return $ret +} + +# Read any local settings/overrides +[ -r /etc/sysconfig/rc.site ] && source /etc/sysconfig/rc.site + +DISTRO=${DISTRO:-"milis"} +DISTRO_CONTACT=${DISTRO_CONTACT:-"milis-dev@milisx.org"} +DISTRO_MINI=${DISTRO_MINI:-"milis"} +IPROMPT=${IPROMPT:-"no"} + +# These 3 signals will not cause our script to exit +trap "" INT QUIT TSTP + +[ "${1}" != "" ] && runlevel=${1} + +if [ "${runlevel}" == "" ]; then + echo "Usage: ${0} " >&2 + exit 1 +fi + +previous=${PREVLEVEL} +[ "${previous}" == "" ] && previous=N + +if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then + log_info_msg "/etc/rc.d/rc${runlevel}.d does not exist.\n" + exit 1 +fi + +if [ "$runlevel" == "6" -o "$runlevel" == "0" ]; then IPROMPT="no"; fi + +# Note: In ${LOGLEVEL:-7}, it is ':' 'dash' '7', not minus 7 +if [ "$runlevel" == "S" ]; then + [ -r /etc/sysconfig/console ] && source /etc/sysconfig/console + dmesg -n "${LOGLEVEL:-7}" +fi + +if [ "${IPROMPT}" == "yes" -a "${runlevel}" == "S" ]; then + # The total length of the distro welcome string, without escape codes + wlen=${wlen:-$(echo "${DISTRO} Hoşgeldiniz" | wc -c )} + welcome_message=${welcome_message:-"${INFO}${DISTRO}${NORMAL} Hoşgeldiniz."} + + # The total length of the interactive string, without escape codes + ilen=${ilen:-$(echo "Press 'I' to enter interactive startup" | wc -c )} + i_message=${i_message:-"Press '${FAILURE}I${NORMAL}' to enter interactive startup"} + + + # dcol and icol are spaces before the message to center the message + # on screen. itime is the amount of wait time for the user to press a key + wcol=$(( ( ${COLUMNS} - ${wlen} ) / 2 )) + icol=$(( ( ${COLUMNS} - ${ilen} ) / 2 )) + itime=${itime:-"3"} + + echo -e "\n\n" + echo -e "\\033[${wcol}G${welcome_message}" + echo -e "\\033[${icol}G${i_message}${NORMAL}" + echo "" + read -t "${itime}" -n 1 interactive 2>&1 > /dev/null +fi + +# Make lower case +[ "${interactive}" == "I" ] && interactive="i" +[ "${interactive}" != "i" ] && interactive="" + +# Read the state file if it exists from runlevel S +[ -r /var/run/interactive ] && source /var/run/interactive + +# Attempt to stop all services started by the previous runlevel, +# and killed in this runlevel +if [ "${previous}" != "N" ]; then + for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null) + do + check_script_status + + suffix=${i#/etc/rc.d/rc$runlevel.d/K[0-9][0-9]} + prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix + sysinit_start=/etc/rc.d/rcS.d/S[0-9][0-9]$suffix + + if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then + if [ ! -f ${prev_start} -a ! -f ${sysinit_start} ]; then + MSG="WARNING:\n\n${i} can't be " + MSG="${MSG}executed because it was not " + MSG="${MSG}not started in the previous " + MSG="${MSG}runlevel (${previous})." + log_warning_msg "$MSG" + continue + fi + fi + + run ${i} stop + error_value=${?} + + if [ "${error_value}" != "0" ]; then print_error_msg; fi + done +fi + +if [ "${previous}" == "N" ]; then export IN_BOOT=1; fi + +if [ "$runlevel" == "6" -a -n "${FASTBOOT}" ]; then + touch /fastboot +fi + + +# Start all functions in this runlevel +for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null) +do + if [ "${previous}" != "N" ]; then + suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]} + stop=/etc/rc.d/rc$runlevel.d/K[0-9][0-9]$suffix + prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix + + [ -f ${prev_start} -a ! -f ${stop} ] && continue + fi + + check_script_status + + case ${runlevel} in + 0|6) + run ${i} stop + ;; + *) + run ${i} start + ;; + esac + + error_value=${?} + + if [ "${error_value}" != "0" ]; then print_error_msg; fi +done + +# Store interactive variable on switch from runlevel S and remove if not +if [ "${runlevel}" == "S" -a "${interactive}" == "i" ]; then + echo "interactive=\"i\"" > /var/run/interactive +else + rm -f /var/run/interactive 2> /dev/null +fi + +# Copy the boot log on initial boot only +if [ "${previous}" == "N" -a "${runlevel}" != "S" ]; then + cat $BOOTLOG >> /var/log/boot.log + + # Mark the end of boot + echo "--------" >> /var/log/boot.log + + # Remove the temporary file + rm -f $BOOTLOG 2> /dev/null +fi + +# End rc diff --git a/ayarlar/servisler/mbd/init.d/reboot b/ayarlar/servisler/mbd/init.d/reboot new file mode 100755 index 000000000..51a4c3b6d --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/reboot @@ -0,0 +1,43 @@ +#!/bin/sh +######################################################################## +# Begin reboot +# +# Description : Reboot Scripts +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: reboot +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: 6 +# Default-Stop: +# Short-Description: Reboots the system. +# Description: Reboots the System. +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + stop) + log_info_msg "sistem yeniden başlatılıyor..." + reboot -d -f -i + ;; + + *) + echo "Kullanım: ${0} {stop}" + exit 1 + ;; + +esac + +# End reboot diff --git a/ayarlar/servisler/mbd/init.d/sendsignals b/ayarlar/servisler/mbd/init.d/sendsignals new file mode 100755 index 000000000..55de3119b --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/sendsignals @@ -0,0 +1,66 @@ +#!/bin/sh +######################################################################## +# Begin sendsignals +# +# Description : Sendsignals Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: sendsignals +# Required-Start: +# Should-Start: +# Required-Stop: $local_fs swap localnet +# Should-Stop: +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Attempts to kill remaining processes. +# Description: Attempts to kill remaining processes. +# X-LFS-Provided-By: LFS +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + stop) + log_info_msg "Sending all processes the TERM signal..." + killall5 -15 + error_value=${?} + + sleep ${KILLDELAY} + + if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then + log_success_msg + else + log_failure_msg + fi + + log_info_msg "Sending all processes the KILL signal..." + killall5 -9 + error_value=${?} + + sleep ${KILLDELAY} + + if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then + log_success_msg + else + log_failure_msg + fi + ;; + + *) + echo "Usage: ${0} {stop}" + exit 1 + ;; + +esac + +exit 0 + +# End sendsignals diff --git a/ayarlar/servisler/mbd/init.d/setclock b/ayarlar/servisler/mbd/init.d/setclock new file mode 100755 index 000000000..15463de94 --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/setclock @@ -0,0 +1,63 @@ +#!/bin/sh +######################################################################## +# Begin setclock +# +# Description : Setting Linux Clock +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: +# Required-Start: +# Should-Start: modules +# Required-Stop: +# Should-Stop: $syslog +# Default-Start: S +# Default-Stop: +# Short-Description: Stores and restores time from the hardware clock +# Description: On boot, system time is obtained from hwclock. The +# hardware clock can also be set on shutdown. +# X-LFS-Provided-By: LFS BLFS +### END INIT INFO + +. /lib/lsb/init-functions + +[ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock + + +case "${UTC}" in + yes|true|1) + CLOCKPARAMS="${CLOCKPARAMS} --utc" + ;; + + no|false|0) + CLOCKPARAMS="${CLOCKPARAMS} --localtime" + ;; + +esac + +case ${1} in + start) + hwclock --hctosys ${CLOCKPARAMS} >/dev/null + ;; + + stop) + log_info_msg "Setting hardware clock..." + hwclock --systohc ${CLOCKPARAMS} >/dev/null + evaluate_retval + ;; + + *) + echo "Usage: ${0} {start|stop}" + exit 1 + ;; + +esac + +exit 0 \ No newline at end of file diff --git a/ayarlar/servisler/mbd/init.d/squid b/ayarlar/servisler/mbd/init.d/squid new file mode 100755 index 000000000..116a3382c --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/squid @@ -0,0 +1,42 @@ +#!/bin/sh +# +# /etc/rc.d/squid: start/stop squid daemon +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/squid +PID=/var/run/squid.pid +OPTS="-Y" + +case $1 in +start) + $SSD --start --pidfile $PID --exec $PROG -- $OPTS + ;; +stop) + $SSD --stop --retry 10 --pidfile $PID --signal INT + ;; +shutdown) + $SSD --stop --retry 60 --pidfile $PID --signal TERM + ;; +restart) + $0 stop + $0 start + ;; +reload) + $SSD --stop --pidfile $PID --signal HUP + ;; +status) + $SSD --status --pidfile $PID + case $? in + 0) echo "$PROG is running with pid $(cat $PID)" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|shutdown|restart|reload|status]" + ;; +esac + +# End of file diff --git a/ayarlar/servisler/mbd/init.d/sysklogd b/ayarlar/servisler/mbd/init.d/sysklogd new file mode 100755 index 000000000..9b08b08f8 --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/sysklogd @@ -0,0 +1,101 @@ +#!/bin/sh +######################################################################## +# Begin sysklogd +# +# Description : Sysklogd loader +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS 7.0 +# +######################################################################## + +### BEGIN INIT INFO +# Provides: $syslog +# Required-Start: localnet +# Should-Start: +# Required-Stop: $local_fs sendsignals +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Starts kernel and system log daemons. +# Description: Starts kernel and system log daemons. +# /etc/fstab. +# X-LFS-Provided-By: LFS +### END INIT INFO + +# Note: sysklogd is not started in runlevel 2 due to possible +# remote logging configurations + +. /lib/lsb/init-functions + +case "${1}" in + start) + log_info_msg "Starting system log daemon..." + parms=${SYSKLOGD_PARMS-'-m 0'} + start_daemon /sbin/syslogd $parms + evaluate_retval + + log_info_msg "Starting kernel log daemon..." + start_daemon /sbin/klogd + evaluate_retval + #sifre degistirme iptal + if [ "`cat /etc/passwd | grep ^root|cut -d ":" -f2`" != "x" ]; then + /sbin/pwconv + /sbin/grpconv + + echo -e "milis\nmilis"|passwd + #chage -d 0 root + fi + ;; + + stop) + log_info_msg "Stopping kernel log daemon..." + killproc /sbin/klogd + evaluate_retval + + log_info_msg "Stopping system log daemon..." + killproc /sbin/syslogd + evaluate_retval + log_info_msg "Cleanup logs..." + for file in sys daemon kern mail auth user boot cron + do + if [ -f /var/log/$file.log ]; then + mv /var/log/$file.log{,.old} + touch /var/log/$file.log + fi + done + mv /var/log/wtmp{,.old} + touch /var/log/wtmp + evaluate_retval + ;; + + reload) + log_info_msg "Reloading system log daemon config file..." + pid=`pidofproc syslogd` + kill -HUP "${pid}" + evaluate_retval + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + statusproc /sbin/syslogd + statusproc klogd + ;; + + *) + echo "Usage: ${0} {start|stop|reload|restart|status}" + exit 1 + ;; +esac + +exit 0 + +# End sysklogd diff --git a/ayarlar/servisler/mbd/init.d/template b/ayarlar/servisler/mbd/init.d/template new file mode 100755 index 000000000..59c5f3cba --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/template @@ -0,0 +1,55 @@ +#!/bin/sh +######################################################################## +# Begin scriptname +# +# Description : +# +# Authors : +# +# Version : LFS x.x +# +# Notes : +# +######################################################################## + +### BEGIN INIT INFO +# Provides: template +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: +# Description: +# X-LFS-Provided-By: +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + log_info_msg "Starting..." + start_daemon fully_qualified_path + ;; + + stop) + log_info_msg "Stopping..." + killproc fully_qualified_path + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; +esac + +exit 0 + +# End scriptname diff --git a/ayarlar/servisler/mbd/init.d/yacy b/ayarlar/servisler/mbd/init.d/yacy new file mode 100644 index 000000000..99e82e7c6 --- /dev/null +++ b/ayarlar/servisler/mbd/init.d/yacy @@ -0,0 +1,37 @@ +#!/bin/sh +# +# /etc/rc.d/yacy: start/stop yacy daemon +# + +# User settings here +DAEMON=yacy +RUN_AS_USER=yacy +# end of user settings + +RETVAL=0 + +case $1 in + start) + echo -n "Starting $DAEMON..." + su $RUN_AS_USER -c /usr/sbin/$DAEMON-start &> /dev/null & RETVAL=$? + echo " done." + ;; + stop) + echo -n "Shutting down $DAEMON..." + su $RUN_AS_USER -c /usr/sbin/$DAEMON-stop &> /dev/null & RETVAL=$? + echo " done." + ;; + restart) + $0 stop + sleep 20 + $0 start + RETVAL=$? + ;; + *) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +exit $RETVAL + +# End of file