next up previous contents
Next: How to burn a Up: Autorun: scripts to be Previous: Summary of rules   Contents

Examples of autorun scripts

 #!/bin/bash
 (
   ifconfig eth0 | head -n 3
   fdisk -l /dev/hda
 ) | tee -a /mnt/autorun/report
 sync
 exit 0
This script will accumulate infos about eth0 network interface and disk partitions into a file named ``report'' on first floppy drive. BIOS boot sequence must specify CD first, ar_source= boot parameter has to be correctly set, diskette must be write-enabled, CD and diskette must be inserted at startup time.

If network is automatically configured at boot (DHCP), you may send infos through a NFS or samba share for example.

Don't forget to give autorun location at startup. Say that you share through NFS a writable directory named /nfs/backup on host myserver, you have to specify : at SystemRescueCd boot prompt and to put in the shared directory an ``autorun'' script like this one :
 #!/bin/bash
 date=$(date +%Y%m%d)
 cat /dev/hda | gzip > /mnt/autorun/$date.hda.gz && exit 0
 echo $date hda backup error
 exit 1
If sufficient space is provided in NFS share, this will copy there a compressed image of your first IDE disk.

You must ensure that name resolution works if you will access NFS server by its name instead of its IP address.



2004-08-17