Initial commit.
This commit is contained in:
commit
3d665e5e11
72 changed files with 3200 additions and 0 deletions
73
sample-rc.d/rc.local_shutdown
Executable file
73
sample-rc.d/rc.local_shutdown
Executable file
|
@ -0,0 +1,73 @@
|
|||
#!/bin/bash
|
||||
# /etc/rc.d/rc.local_shutdown - Local system shutdown script.
|
||||
# This script will be run when the system is shutdown or rebooted.
|
||||
|
||||
# Notify that the server is shutting down.
|
||||
/opt/bin/pushover -a server -t "Shutting down: ${HOSTNAME%%.*}" -p 1 -m "$(printf '%(%d %b %Y - %H:%M:%S)T')" >/dev/null
|
||||
|
||||
# Stop containers.
|
||||
[ -x /etc/rc.d/rc.lxc ] && /etc/rc.d/rc.lxc stop
|
||||
|
||||
# Stop lxcfs.
|
||||
[ -x /etc/rc.d/rc.lxcfs ] && /etc/rc.d/rc.lxcfs stop
|
||||
|
||||
# Stop libvirt.
|
||||
[ -x /etc/rc.d/rc.libvirt ] && {
|
||||
/etc/rc.d/rc.libvirt guests_shutdown
|
||||
/etc/rc.d/rc.libvirt stop
|
||||
}
|
||||
|
||||
# Shut down netdata.
|
||||
[ -x /etc/rc.d/rc.netdata ] && /etc/rc.d/rc.netdata 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.
|
||||
[ -x /etc/rc.d/rc.rsyncd ] && /etc/rc.d/rc.rsyncd stop
|
||||
|
||||
# Stop proftpd.
|
||||
[ -x /etc/rc.d/rc.proftpd ] && /etc/rc.d/rc.proftpd stop
|
||||
|
||||
# Stop SpamAssassin.
|
||||
[ -x /etc/rc.d/rc.spamd ] && /etc/rc.d/rc.spamd stop
|
||||
|
||||
# Stop the php-fpm FastCGI daemon.
|
||||
[ -x /etc/rc.d/rc.php-fpm ] && /etc/rc.d/rc.php-fpm stop
|
||||
|
||||
# Stop fail2ban.
|
||||
[ -x /etc/rc.d/rc.fail2ban ] && /etc/rc.d/rc.fail2ban stop
|
||||
|
||||
# Stop the vnstat daemon.
|
||||
[ -x /etc/rc.d/rc.vnstat ] && /etc/rc.d/rc.vnstat stop
|
||||
|
||||
# Unmount glusterfs volumes.
|
||||
for MOUNT in $(mount | awk '/fuse\.glusterfs/ {print $3}'); do umount -v $MOUNT; done
|
||||
|
||||
# Stop GlusterFS daemon.
|
||||
[ -x /etc/rc.d/rc.glusterd ] && /etc/rc.d/rc.glusterd 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.
|
||||
[ -x /etc/rc.d/rc.mcelog ] && /etc/rc.d/rc.mcelog stop
|
Loading…
Add table
Add a link
Reference in a new issue