Update rc.local*.
This commit is contained in:
parent
421d14a4c2
commit
6fb489f1e8
2 changed files with 54 additions and 75 deletions
|
|
@ -1,66 +1,70 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# /etc/rc.d/rc.local - Local system startup script.
|
# /etc/rc.d/rc.local - Local system startup script.
|
||||||
# This script will be run when the system is first booted.
|
# Copyright (c) 2005-2022:
|
||||||
|
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
|
||||||
|
# Licensed under the terms of the GNU General Public License version 3.
|
||||||
|
|
||||||
# Start the MCE daemon.
|
# Start the MCE daemon.
|
||||||
[ -x /etc/rc.d/rc.mcelog ] && /etc/rc.d/rc.mcelog start
|
[[ -x /etc/rc.d/rc.mcelog ]] && /etc/rc.d/rc.mcelog start
|
||||||
|
|
||||||
# Start the qemu guest additions agent.
|
# Start the Open VM Tools daemon.
|
||||||
[ -x /etc/rc.d/rc.qemu-ga ] && /etc/rc.d/rc.qemu-ga start
|
[[ -x /etc/rc.d/rc.vmtoolsd ]] && /etc/rc.d/rc.vmtoolsd start
|
||||||
|
|
||||||
# Start GlusterFS daemon.
|
|
||||||
[ -x /etc/rc.d/rc.glusterd ] && /etc/rc.d/rc.glusterd start
|
|
||||||
|
|
||||||
# Start the vnstat daemon.
|
# Start the vnstat daemon.
|
||||||
[ -x /etc/rc.d/rc.vnstat ] && /etc/rc.d/rc.vnstat start
|
[[ -x /etc/rc.d/rc.vnstat ]] && /etc/rc.d/rc.vnstat start
|
||||||
|
|
||||||
# Start netdata.
|
|
||||||
[ -x /etc/rc.d/rc.netdata ] && /etc/rc.d/rc.netdata start
|
|
||||||
|
|
||||||
# Start fail2ban.
|
# Start fail2ban.
|
||||||
[ -x /etc/rc.d/rc.fail2ban ] && /etc/rc.d/rc.fail2ban start
|
[[ -x /etc/rc.d/rc.fail2ban ]] && /etc/rc.d/rc.fail2ban start
|
||||||
|
|
||||||
|
# Start netdata.
|
||||||
|
[[ -x /etc/rc.d/rc.netdata ]] && /etc/rc.d/rc.netdata start
|
||||||
|
|
||||||
# Start the php-fpm FastCGI daemon.
|
# Start the php-fpm FastCGI daemon.
|
||||||
[ -x /etc/rc.d/rc.php-fpm ] && /etc/rc.d/rc.php-fpm start
|
[[ -x /etc/rc.d/rc.php-fpm ]] && /etc/rc.d/rc.php-fpm start
|
||||||
|
|
||||||
# Start SpamAssassin.
|
# Start SpamAssassin.
|
||||||
[ -x /etc/rc.d/rc.spamd ] && /etc/rc.d/rc.spamd start
|
[[ -x /etc/rc.d/rc.spamd ]] && /etc/rc.d/rc.spamd start
|
||||||
|
|
||||||
# Start greylistd.
|
# Start greylistd.
|
||||||
[ -x /etc/rc.d/rc.greylistd ] && /etc/rc.d/rc.greylistd start
|
[[ -x /etc/rc.d/rc.greylistd ]] && /etc/rc.d/rc.greylistd start
|
||||||
|
|
||||||
|
# Start Exim.
|
||||||
|
[[ -x /etc/rc.d/rc.exim ]] && /etc/rc.d/rc.exim start
|
||||||
|
|
||||||
|
# FIXME: Move the lumberjack starts into the rc.ds?
|
||||||
# Start proftpd.
|
# Start proftpd.
|
||||||
[ -x /etc/rc.d/rc.proftpd ] && {
|
[[ -x /etc/rc.d/rc.proftpd ]] && {
|
||||||
/opt/bin/lumberjack -u logger -z -r -i /run/slackware.uk-ftpd.log -o logger:ftp -mp 006 -l logs/ftpd-transfers.log \
|
[[ -x /opt/bin/lumberjack ]] && {
|
||||||
/data/sites/slackware.uk logs/%Y/%m/ftpd-transfers.log &
|
if [[ -x /usr/bin/daemon ]]; then
|
||||||
|
/usr/bin/daemon -N -n lumberjack-ftpd -r -a 60 -A 5 -L 300 -o daemon.debug -- /opt/bin/lumberjack -u logger -z -r -i /run/slackware.uk-ftpd.log \
|
||||||
|
-o logger:ftp -mp 006 -l logs/ftpd-transfers.log /data/sites/slackware.uk logs/%Y/%m/ftpd-transfers.log
|
||||||
|
else
|
||||||
|
/opt/bin/lumberjack -u logger -z -r -i /run/slackware.uk-ftpd.log -o logger:ftp -mp 006 -l logs/ftpd-transfers.log /data/sites/slackware.uk \
|
||||||
|
logs/%Y/%m/ftpd-transfers.log &
|
||||||
|
fi
|
||||||
|
}
|
||||||
/etc/rc.d/rc.proftpd start
|
/etc/rc.d/rc.proftpd start
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start the rsync daemon.
|
# Start the rsync daemon.
|
||||||
[ -x /etc/rc.d/rc.rsyncd ] && {
|
[[ -x /etc/rc.d/rc.rsyncd ]] && {
|
||||||
/opt/bin/lumberjack -u logger -z -r -i /run/rsyncd.log -o logger:mirror -mp 006 -l logs/rsyncd-transfers.log \
|
[[ -x /opt/bin/lumberjack ]] && {
|
||||||
/data/sites/slackware.uk logs/%Y/%m/rsyncd-transfers.log &
|
if [[ -x /usr/bin/daemon ]]; then
|
||||||
|
/usr/bin/daemon -N -n lumberjack-rsyncd -r -a 60 -A 5 -L 300 -o daemon.debug -- /opt/bin/lumberjack -u logger -z -r -i /run/rsyncd.log \
|
||||||
|
-o logger:mirror -mp 006 -l logs/rsyncd-transfers.log /data/sites/slackware.uk logs/%Y/%m/rsyncd-transfers.log
|
||||||
|
else
|
||||||
|
/opt/bin/lumberjack -u logger -z -r -i /run/rsyncd.log -o logger:mirror -mp 006 -l logs/rsyncd-transfers.log /data/sites/slackware.uk \
|
||||||
|
logs/%Y/%m/rsyncd-transfers.log &
|
||||||
|
fi
|
||||||
|
}
|
||||||
/etc/rc.d/rc.rsyncd start
|
/etc/rc.d/rc.rsyncd start
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start the bandwidth bar generator.
|
# Start the bandwidth bar generator.
|
||||||
[ -x /opt/bin/bwbar ] && sudo -b /opt/bin/bwbar -f /run/bwbar.txt -p /run/bwbar.png -t 1 -x 800 -y 8 -b 2 eth0 1000
|
[ -x /etc/rc.d/rc.bwbar ] && /etc/rc.d/rc.bwbar start
|
||||||
|
|
||||||
# Start seeding the torrents.
|
# Start seeding the torrents.
|
||||||
grep "^seeder:" /etc/passwd >/dev/null 2>&1 && su - seeder -c /home/seeder/start-seeding
|
[[ -x /etc/rc.d/rc.seeder ]] && /etc/rc.d/rc.seeder start
|
||||||
|
|
||||||
# Start libvirt.
|
|
||||||
[ -x /etc/rc.d/rc.libvirt ] && /etc/rc.d/rc.libvirt start
|
|
||||||
|
|
||||||
# Start the lxcfs fuse module.
|
|
||||||
[ -x /etc/rc.d/rc.lxcfs ] && /etc/rc.d/rc.lxcfs start
|
|
||||||
|
|
||||||
# Start containers.
|
|
||||||
[ -x /etc/rc.d/rc.lxc ] && {
|
|
||||||
# Proxy ARP is required for the LXC bridge to function correctly.
|
|
||||||
echo 1 >/proc/sys/net/ipv4/conf/br0/proxy_arp
|
|
||||||
/etc/rc.d/rc.lxc start
|
|
||||||
}
|
|
||||||
|
|
||||||
# Notify that the server has booted.
|
# Notify that the server has booted.
|
||||||
CONFIG_FILE="server" /opt/bin/pushover -T "Successful boot up: ${HOSTNAME%%.*}" -p 1 -m "$(printf '%(%d %b %Y - %H:%M:%S)T')"
|
CONFIG_FILE="server" /opt/bin/pushover -T "${HOSTNAME%%.*}" -p 1 -m "Successful boot up."
|
||||||
|
|
|
||||||
|
|
@ -3,41 +3,13 @@
|
||||||
# This script will be run when the system is shutdown or rebooted.
|
# This script will be run when the system is shutdown or rebooted.
|
||||||
|
|
||||||
# Notify that the server is shutting down.
|
# Notify that the server is shutting down.
|
||||||
CONFIG_FILE="server" /opt/bin/pushover -T "Shutting down: ${HOSTNAME%%.*}" -p 1 -m "$(printf '%(%d %b %Y - %H:%M:%S)T')"
|
CONFIG_FILE="server" /opt/bin/pushover -T "${HOSTNAME%%.*}" -p 1 -m "Shutting down."
|
||||||
|
|
||||||
# Stop containers.
|
# Stop seeding the torrents.
|
||||||
[ -x /etc/rc.d/rc.lxc ] && /etc/rc.d/rc.lxc stop
|
[[ -x /etc/rc.d/rc.seeder ]] && /etc/rc.d/rc.seeder stop
|
||||||
|
|
||||||
# Stop lxcfs.
|
# Stop the bandwidth bar generator.
|
||||||
[ -x /etc/rc.d/rc.lxcfs ] && /etc/rc.d/rc.lxcfs stop
|
[ -x /etc/rc.d/rc.bwbar ] && /etc/rc.d/rc.bwbar stop
|
||||||
|
|
||||||
# Stop libvirt.
|
|
||||||
[ -x /etc/rc.d/rc.libvirt ] && {
|
|
||||||
/etc/rc.d/rc.libvirt guests_shutdown
|
|
||||||
/etc/rc.d/rc.libvirt stop
|
|
||||||
}
|
|
||||||
|
|
||||||
# Stop the rtorrent instances started at boot.
|
|
||||||
grep "^seeder:" /etc/passwd >/dev/null 2>&1 && {
|
|
||||||
pkill -INT -u seeder '^rtorrent .*$'
|
|
||||||
printf "%s" "Waiting up to 30 seconds for rtorrent to exit"
|
|
||||||
for ((i=0; i <= 59; i++)); do
|
|
||||||
if pgrep -u seeder '^rtorrent .*$' >/dev/null 2>&1; then
|
|
||||||
printf "%s" "."
|
|
||||||
sleep 0.5
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if ! pgrep -u seeder '^rtorrent .*$' >/dev/null 2>&1; then
|
|
||||||
printf "%s\n" " clean exit."
|
|
||||||
else
|
|
||||||
printf "%s\n" " failed - terminating."
|
|
||||||
pkill -TERM -u seeder '^rtorrent .*$'
|
|
||||||
sleep 2
|
|
||||||
pkill -KILL -u seeder '^rtorrent .*$'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Stop rsyncd.
|
# Stop rsyncd.
|
||||||
[ -x /etc/rc.d/rc.rsyncd ] && /etc/rc.d/rc.rsyncd stop
|
[ -x /etc/rc.d/rc.rsyncd ] && /etc/rc.d/rc.rsyncd stop
|
||||||
|
|
@ -45,6 +17,9 @@ grep "^seeder:" /etc/passwd >/dev/null 2>&1 && {
|
||||||
# Stop proftpd.
|
# Stop proftpd.
|
||||||
[ -x /etc/rc.d/rc.proftpd ] && /etc/rc.d/rc.proftpd stop
|
[ -x /etc/rc.d/rc.proftpd ] && /etc/rc.d/rc.proftpd stop
|
||||||
|
|
||||||
|
# Stop Exim.
|
||||||
|
[[ -x /etc/rc.d/rc.exim ]] && /etc/rc.d/rc.exim stop
|
||||||
|
|
||||||
# Stop greylistd.
|
# Stop greylistd.
|
||||||
[ -x /etc/rc.d/rc.greylistd ] && /etc/rc.d/rc.greylistd stop
|
[ -x /etc/rc.d/rc.greylistd ] && /etc/rc.d/rc.greylistd stop
|
||||||
|
|
||||||
|
|
@ -54,6 +29,9 @@ grep "^seeder:" /etc/passwd >/dev/null 2>&1 && {
|
||||||
# Stop the php-fpm FastCGI daemon.
|
# Stop the php-fpm FastCGI daemon.
|
||||||
[ -x /etc/rc.d/rc.php-fpm ] && /etc/rc.d/rc.php-fpm stop
|
[ -x /etc/rc.d/rc.php-fpm ] && /etc/rc.d/rc.php-fpm stop
|
||||||
|
|
||||||
|
# Stop netdata.
|
||||||
|
[[ -x /etc/rc.d/rc.netdata ]] && /etc/rc.d/rc.netdata stop
|
||||||
|
|
||||||
# Stop fail2ban.
|
# Stop fail2ban.
|
||||||
[ -x /etc/rc.d/rc.fail2ban ] && /etc/rc.d/rc.fail2ban stop
|
[ -x /etc/rc.d/rc.fail2ban ] && /etc/rc.d/rc.fail2ban stop
|
||||||
|
|
||||||
|
|
@ -63,11 +41,8 @@ grep "^seeder:" /etc/passwd >/dev/null 2>&1 && {
|
||||||
# Stop the vnstat daemon.
|
# Stop the vnstat daemon.
|
||||||
[ -x /etc/rc.d/rc.vnstat ] && /etc/rc.d/rc.vnstat stop
|
[ -x /etc/rc.d/rc.vnstat ] && /etc/rc.d/rc.vnstat stop
|
||||||
|
|
||||||
# Stop GlusterFS daemon.
|
# Stop the Open VM Tools daemon.
|
||||||
[ -x /etc/rc.d/rc.glusterd ] && /etc/rc.d/rc.glusterd stop
|
[[ -x /etc/rc.d/rc.vmtoolsd ]] && /etc/rc.d/rc.vmtoolsd stop
|
||||||
|
|
||||||
# Stop the qemu guest additions agent.
|
|
||||||
[ -x /etc/rc.d/rc.qemu-ga ] && /etc/rc.d/rc.qemu-ga stop
|
|
||||||
|
|
||||||
# Stop the MCE daemon.
|
# Stop the MCE daemon.
|
||||||
[ -x /etc/rc.d/rc.mcelog ] && /etc/rc.d/rc.mcelog stop
|
[ -x /etc/rc.d/rc.mcelog ] && /etc/rc.d/rc.mcelog stop
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue