Skip to content

Instantly share code, notes, and snippets.

@CodeSturgeon
Created January 7, 2012 02:12
Show Gist options
  • Save CodeSturgeon/1573498 to your computer and use it in GitHub Desktop.
Save CodeSturgeon/1573498 to your computer and use it in GitHub Desktop.
Admin Scripts
#!/bin/sh
echo $HOSTNAME booting
HOME=/root/admin_scripts/
@reboot ~/boot_note.sh
@daily ~/gentoo/glsa_test.sh
@daily ~/gentoo/sync_and_download.sh
@weekly ~/gentoo/listworld_and_mirrorselect.sh
#!/bin/sh
/usr/bin/glsa-check -t all 2>/dev/null
#!/bin/sh
# Shutdown fancy output from tools
TERM=plain
export TERM
# Make sure we using the best current mirrors
/usr/sbin/mirrorselect -q -s5 > /dev/null
# List all possible upgrade packages with detail
emerge -lpu --deep world
# FIXME read the news
#!/bin/bash
df /home | tail -n 1 | awk '{if (($4/$2)*100 < 10) print "Space used on /home: " $5 " (" ($4/(1024^2)) " GiB free)" }'
#!/bin/sh
# Sync portage
emerge --sync --quiet >/dev/null 2>&1
# Download all the files I'm likely to need for updates
emerge -uDF --quiet world >/dev/null 2>&1
#!/bin/bash
# WARNING: This is a work in progress... do not use
# requires genkernel and perhaps gentoolkit
# find most recent kernel name
KVERSION=`find /usr/src/ -maxdepth 1 -type d -name 'linux-*' | sort | tail -n 1`
# select most recent kernel
eselect kernel set $KVERSION
# install current running config
zcat /proc/config.gz > /usr/src/linux/.config
# compile and install most recent kernel
# no-clean : assume I want anything already compiled to be re-used
# menuconfig : just in case I want to change something or look it over
genkernel --menuconfig --bootloader=grub --install --no-clean --oldconfig --mountboot all
# update grub (or give instructions) if needed
# FIXME update for failback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment