4.2.2 Scripts on the computer's local harddisks

Another trigger is to have a script executed from the computer 's local harddisk, allowing you to run commands specifically for the computer. It is in the same format as the trk3options.conf: you have TRKSECTION TRKSCRIPT (only this section) where you write your parameters. This will be generated into a script called /bin/trklocscript-<name of the drive> (f.i. /bin/trklocscript-hda1) and executed at the end of the TRK startup procedure.
The location of this script has to be in the folder .trk (dot trk) on the root of the local partition. In this folder you put the file called trk3local.conf.
A sample trk3local.conf could look like this:
TRKSECTION TRKSCRIPT BEGIN

#!/bin/bash
# Script for maintenance and backup on Windows machines
# Clean up this drive a little and do a virusscan on it
cd /hda1/Documents\ and\ Settings
for i in *; do rm -rf "$i"\Local\ Settings\Temp\*; rm -rf "$i"\Local\ Settings\Temporary Internet Files\*;
done;
virusscan -a fprot
# Now back up the userdata of all local profiles to a network drive
mount -o username=john,password=doe //10.0.0.5/backups /mnt0
for i in *; do mkdir /mnt0/"$i" 2>/dev/null; echo "Backing up documents of $i"; cp -rvf "$i"/My\ Documents /mnt0/"$i"; done
umountallfs