w jakim jezyku jest napisany tez skrypt
perl czy c++:
#!/bin/ksh
# find core dumps and mail file info to root
# Des Warren, Paul Warren
# 7/3/01
### findcores.sh does a search for core files, runs a file
### command on them to see which program created the core,
### and mails the results before deleting the core.
###
### Submitter Name: Des Warren
### Submitter Email: [email protected]
### Find the core files
find / -name core -type f > /tmp/cores$$
function mailcores
{
for i in $( </tmp/cores$$ )
do
echo "" >> /tmp/mailcores
file $i >> /tmp/mailcores
echo "" >> /tmp/mailcores
rm $i
done
mailx -s "core on `uname -n` " root < /tmp/mailcores
rm /tmp/mailcores
rm /tmp/cores$$
}
[[ -s /tmp/cores$$ ]] && mailcores
i jeszcze jeden skrypt
tez pytanie : jaki to jezyk
#!/bin/ksh
#
## Title: client_bkp.sh
## Script submitted to BigAdmin ~ http://www.bigadmin.com/scripts
##
## Submitter: Marco Corte
## Author: Marco Corte
## Submitter Email: [email protected]
## Created: 20/7/2000
## Modified 19/3/2001: first public version
## Modified 14/5/2002: fixed weekday calculation in Solaris 8
# Description:
# This script does ufsdump or vxdump of a list of filesystem based on the
# weekday. Optionally it takes a weekday number (1=sunday) from the command
# line.
# Tested with Solaris 2.6, 7 and 8.
# In this example the host has two ufs (/ and /extra1) and two vxfs
# (/extra2 and /extra3) filesystems.
# /extra2 and /extra3 share the same schedule named "VX", while / and /extra1
# have their own settings.
# Daily backup schedule. Carefully check if this backup script starts before
# or after midnight.
#
# sched: schedule name; entries can be shared among filesystems.
# fstype: specify if you need to (ufs)dump or (vx)dump a filesystem
# sun-sat: backup level for each weekday: 0-9 or "s" if you want to skip it
#----------------------------------------------------------------------------#
# sched fstype sun mon tue wed thu fri sat #
#----------------------------------------------------------------------------#
set -A root ufs s s s s s s 0
set -A extra1 ufs 5 4 3 2 1 0 6
set -A VX vx 9 9 9 9 0 9 9
#----------------------------------------------------------------------------#
# If defined, send the log to this email address
#NTFY="[email protected]"
# If defined, print the log to this printer
PRNT="lp1 -o nobanner"
# During the backup copy the messages to this file
DMPFL=/tmp/dumpfile
# Norewind tape device to use.
#DEV="bkp@oscar:/dev/rmt/1n"
DEV=/dev/rmt/0n
# If defined, eject the tape at the end of the backup with this command
EJECT=rewoffl
PATH=/usr/bin:/sbin:/usr/sbin
save() {
if [ "$2" = "s" ]
then
echo "Skipping $1" | tee -a ${DMPFL}
else
echo "Dumping $1" | tee -a ${DMPFL}
B=`date`
${3}dump ${2}uf $DEV $1 2>&1 | tee -a ${DMPFL}
echo "Begin: $B" | tee -a ${DMPFL}
echo "End: `date`" | tee -a ${DMPFL}
fi
echo "" | tee -a ${DMPFL}
}
case $1 in
1|2|3|4|5|6|7)
DOW=$1
;;
*)
if [ "`uname -r`" = "5.8" ] ; then
DOW=$((`date '+%u'`+1))
else
DOW=`date '+%u'`
fi
;;
esac
BEGIN=`date`
rm ${DMPFL}
#
# Syntax: save <fs_mountpoint> <backup_level> <fs_type>
#
# Customize!
##################################################
save / ${root[$DOW]} ${root[0]}
save /extra1 ${extra1[$DOW]} ${extra1[0]}
save /extra2 ${VX[$DOW]} ${VX[0]}
save /extra3 ${VX[$DOW]} ${VX[0]}
##################################################
echo "nTotal time:" | tee -a ${DMPFL}
echo "BEGIN: ${BEGIN}" | tee -a ${DMPFL}
echo "END: `date`" | tee -a ${DMPFL}
if [ -n "$NTFY" ] ; then
mailx -s "Backup finished on `uname -n`" $NTFY < ${DMPFL}
fi
if [ -n "$PRNT" ] ; then
lp -d $PRNT ${DMPFL}
fi
if [ -n "$EJECT" ] ; then
mt -f $DEV $EJECT
fi
perl czy c++:
#!/bin/ksh
# find core dumps and mail file info to root
# Des Warren, Paul Warren
# 7/3/01
### findcores.sh does a search for core files, runs a file
### command on them to see which program created the core,
### and mails the results before deleting the core.
###
### Submitter Name: Des Warren
### Submitter Email: [email protected]
### Find the core files
find / -name core -type f > /tmp/cores$$
function mailcores
{
for i in $( </tmp/cores$$ )
do
echo "" >> /tmp/mailcores
file $i >> /tmp/mailcores
echo "" >> /tmp/mailcores
rm $i
done
mailx -s "core on `uname -n` " root < /tmp/mailcores
rm /tmp/mailcores
rm /tmp/cores$$
}
[[ -s /tmp/cores$$ ]] && mailcores
i jeszcze jeden skrypt
tez pytanie : jaki to jezyk
#!/bin/ksh
#
## Title: client_bkp.sh
## Script submitted to BigAdmin ~ http://www.bigadmin.com/scripts
##
## Submitter: Marco Corte
## Author: Marco Corte
## Submitter Email: [email protected]
## Created: 20/7/2000
## Modified 19/3/2001: first public version
## Modified 14/5/2002: fixed weekday calculation in Solaris 8
# Description:
# This script does ufsdump or vxdump of a list of filesystem based on the
# weekday. Optionally it takes a weekday number (1=sunday) from the command
# line.
# Tested with Solaris 2.6, 7 and 8.
# In this example the host has two ufs (/ and /extra1) and two vxfs
# (/extra2 and /extra3) filesystems.
# /extra2 and /extra3 share the same schedule named "VX", while / and /extra1
# have their own settings.
# Daily backup schedule. Carefully check if this backup script starts before
# or after midnight.
#
# sched: schedule name; entries can be shared among filesystems.
# fstype: specify if you need to (ufs)dump or (vx)dump a filesystem
# sun-sat: backup level for each weekday: 0-9 or "s" if you want to skip it
#----------------------------------------------------------------------------#
# sched fstype sun mon tue wed thu fri sat #
#----------------------------------------------------------------------------#
set -A root ufs s s s s s s 0
set -A extra1 ufs 5 4 3 2 1 0 6
set -A VX vx 9 9 9 9 0 9 9
#----------------------------------------------------------------------------#
# If defined, send the log to this email address
#NTFY="[email protected]"
# If defined, print the log to this printer
PRNT="lp1 -o nobanner"
# During the backup copy the messages to this file
DMPFL=/tmp/dumpfile
# Norewind tape device to use.
#DEV="bkp@oscar:/dev/rmt/1n"
DEV=/dev/rmt/0n
# If defined, eject the tape at the end of the backup with this command
EJECT=rewoffl
PATH=/usr/bin:/sbin:/usr/sbin
save() {
if [ "$2" = "s" ]
then
echo "Skipping $1" | tee -a ${DMPFL}
else
echo "Dumping $1" | tee -a ${DMPFL}
B=`date`
${3}dump ${2}uf $DEV $1 2>&1 | tee -a ${DMPFL}
echo "Begin: $B" | tee -a ${DMPFL}
echo "End: `date`" | tee -a ${DMPFL}
fi
echo "" | tee -a ${DMPFL}
}
case $1 in
1|2|3|4|5|6|7)
DOW=$1
;;
*)
if [ "`uname -r`" = "5.8" ] ; then
DOW=$((`date '+%u'`+1))
else
DOW=`date '+%u'`
fi
;;
esac
BEGIN=`date`
rm ${DMPFL}
#
# Syntax: save <fs_mountpoint> <backup_level> <fs_type>
#
# Customize!
##################################################
save / ${root[$DOW]} ${root[0]}
save /extra1 ${extra1[$DOW]} ${extra1[0]}
save /extra2 ${VX[$DOW]} ${VX[0]}
save /extra3 ${VX[$DOW]} ${VX[0]}
##################################################
echo "nTotal time:" | tee -a ${DMPFL}
echo "BEGIN: ${BEGIN}" | tee -a ${DMPFL}
echo "END: `date`" | tee -a ${DMPFL}
if [ -n "$NTFY" ] ; then
mailx -s "Backup finished on `uname -n`" $NTFY < ${DMPFL}
fi
if [ -n "$PRNT" ] ; then
lp -d $PRNT ${DMPFL}
fi
if [ -n "$EJECT" ] ; then
mt -f $DEV $EJECT
fi