#!/bin/sh # # Filename: save_alls.sh (shell script) # # Author: Kevin FitzGerrell # Comments to: kfitz@gci.net or fitzgerrell@yahoo.com # # Usage: run without parameters from the shell or scheduled via crontab. # If desired, (esp. in crontab) redirect output to /opt/save/save_alls.log, # ie: save_alls.sh > /opt/save/save_alls.log # # Description: This will do savealls of the CPs and AB stations on your # system to the hard drive. It checks for the /opt/save directory and # creates it if it is not present. Scheduled to run weekly at a quiet time # of the day (or night) it will aid in ensuring the presence of a fairly # recent saveall of each station. This script should run fairly quickly # (several minutes on my system) without using significant amounts of system # resources (no more than doing the savealls from the ICC. Do not run ICC # while this script is executing. # check to see if /opt/save directory exists, otherwise create it if [ ! -d /opt/save ] then mkdir /opt/save fi # because this script's standard output will typically be redirected to a # log file, first send date and time to stdout date # get a list of the stations, CPs and ABs should be type 201-209 # the white space in front of 20[1-9] in the grep is a tab STATIONS=`cat /usr/fox/sp/hldb | grep " 20[1-9]" | awk '{ print $1 }'` # finally, change directories and do the savealls cd /opt/fox/ciocfg/api for x in $STATIONS do /opt/fox/ciocfg/api/save_all $x /opt/save sleep 15 done