Upstart
Here I'm just listing some upstart scripts I've written to manage tasks not assumed by default configuration
iptables
I dont want to use some weird bloatware just to install couple of rules I need to protect my machine. So here we go...
/etc/init/iptables.conf: description "Starts and stops firewall by restoring ip[6]tables policies. Save rules with iptables-save > /etc/default/iptables and ip6tables-save > /etc/default/ip6tables" author "Ruslan N. Marchenko <me(o)ruff.mobi>" start on runlevel [2345] or net-device-up IFACE!=lo stop on runlevel [!2345] emits firewall #task console output pre-start script test -f /etc/default/iptables && /sbin/iptables-restore < /etc/default/iptables test -f /etc/default/ip6tables && /sbin/ip6tables-restore < /etc/default/ip6tables end script post-stop script /etc/default/iptables -F /etc/default/ip6tables -F end script
vgaswitcheroo
This nice pice of kernel code from Dave Airlie enables us to manage switchable graphic (optimus in NVidia world). This upstart script will just switch off discrete graphic card on startup and turn it on before shutting down (otherwise kernel is not quite happy while de-initializing kms)
/etc/init/radeon.conf:
description "Workaround for ATi Mobility Radeon card, switches off discrete card
using vgaswitcheroo"
author "Ruslan N. Marchenko <me(o)ruff.mobi>"
start on virtual-filesystems
stop on runlevel [!2345]
pre-start exec modprobe radeon
post-start script
echo -en "Switching off discrete VGA card."
until grep Off /sys/kernel/debug/vgaswitcheroo/switch
do
sleep 1
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
echo -en "."
done
echo " Done"
end script
post-stop script
echo ON > /sys/kernel/debug/vgaswitcheroo/switch
end script
Link...
Sat Jan 10 02:04:21 2009
Upd.: Wed Dec 19 00:21:33 2012