#!/bin/bash
#
# /usr/local/bin/nocturnal :: script for nighttime processing
# Place whatever commands you wish to execute at night here
/usr/local/bin/backup-scp
yum -y update
# Shut the system back off - you can use pm-hibernate here
# if it works on your system
shutdown -h now
Replace the last line with pm-hibernate if hibernation works on your system and you wish to reduce the startup time in the morning.
Edit your crontab :
# crontab -e
Add a line to execute the nocturnal script a few minutes after your preset wake-up time:
# Perform nighttime processing after the 4:30 wake-up
35 4 * * * /usr/local/bin/nocturnal
If you shut down the system at the end of your working day, it will wake up at night, perform the processing you have configured, and then shut down.
If your system supports changing the alarm time through ACPI, you can schedule multiple wake-up times: have your system start up in the middle of the night and perform the operations described above, and then have it schedule the next wake-up time before shutting down:
#!/bin/bash
#
# /usr/local/bin/nocturnal :: script for nighttime processing
# Please whatever commands you wish to execute at night here
/usr/local/bin/backup-scp
yum -y update
# Schedule another wake-up
date "+%Y-%m-%d
07:50:00 " >/proc/acpi/alarm
# Shut the system back off; you can use pm-hibernate here
# if it works on your system
shutdown -h now
This sets the next wake-up for 7:50 a.m. the same day, just in time to start work at 8 a.m. If your nocturnal processing takes place before midnight, schedule the wake-up for the following day:
# Schedule another wake-up
date +"%Y-%m-%d 07:50:00" -d tomorrow >/proc/acpi/alarm
3.1.4. Where Can I Learn More?
gnome-power-managerACPI Promoters' web site, including the ACPI specification: http://www.acpi.info/
"Linux ACPI-Howto, The Sequel": http://www.columbia.edu/~ariel/acpi/acpi_howto.html
The manpage for hdparm
3.2. Configuring Networking
3.2.1. How Do I Do That?
Graphical configuration tool
The best approach for desktop and server systems that will connect to one or two networks and rarely require changes to the network configuration
NetworkManager
Excellent for laptops that will be connecting to a variety of different networks, but only compatible with certain network hardware
Network configuration commands
Good for experimentation, remote administration, and very complex configurations
3.2.1.1. Configuring networking graphically
neatFigure 3-6. Network Configuration window
To add a network connection, click on the New icon. The window in Figure 3-7 will appear, enabling you to select the connection type.
Figure 3-7. New Device Type window
Use the default Ethernet connection option for any LAN connection, including cable modem connections as well as all DSL connections made through a router or gateway device. Click Forward to proceed to the device-selection window in Figure 3-8 .
Figure 3-8. Device-selection window
All of the Ethernet devices that have been automatically detected (or previously configured manually) will be listed, with the device name in parentheses (such as eth0 ). Select the device you wish to configure and click Forward.
If the device is not in the list, select Other Ethernet Card from the bottom of the list and click Forward. The window shown in Figure 3-9 will appear; select the Adapter type (which selects the device driver to be used), the device name to be used (the default is usually OK), and any resources the card will use (this area should almost always be left blank). Click Forward.
Figure 3-9. New device-setup window
You will now see the window shown in Figure 3-10 . Select one of the two options to assign the IP address for this network connection:
Automatically obtain IP address settings
Use this option if you wish to use an IP address assigned by a system on your network (such as another computer running a DHCP server, a gateway or router device, or a cable modem). Set the adjacent protocol
control to DHCP unless your network uses the older BOOTP protocol (rare).
Statically set IP addresses
Select this option to manually configure the IP address. Fill in the IP address, subnet mask, and gateway (router) address in the labeled fields.
Click Forward to proceed.
Figure 3-10. IP address configuration
Figure 3-11 shows the final confirmation window that appears. Review the information for accuracy and then click Apply.
Figure 3-11. Confirmation window
3.2.1.1.1. Changing a device configuration
The editing window includes some options that are unavailable when the device is first created.Figure 3-12. Network Configuration device-editing window
There are three tabs in this window. The first tab, General, provides fields for basic device configuration:
Nickname
Any name of your choice. This is provided only for your reference; for example, if you have two Ethernet cards, you might nickname one Internet and the other Corporate to identify the networks to which they are connected.