1、backup_run.sh
复制代码 代码如下:
#!/bin/sh
# backup_run
# script to run the backups
# loads in a setting file for the user to change
SOURCE=/home/bob/backup.defaults
check_source()
{
# check_source
# can we load the file
# backup.defaults is the source file containing config/functions
# make sure your path includes this directory you are runing from
if [ -r $SOURCE ];then
. $SOURCE # load $source
else
echo "`basename $0`: cannot locate default file"
exit 1
fi
}
header()
{
# header
USER=`whoami`
MYDATE=`date +%A" "%e" of "%B-%Y`
clear
cat << HH
User: $USER $MYDATE
NETWORK SYSTEM BACKUP
=====================
HH
}
change_settings()
{
# change_settings
# let the user see the default settings..
header
echo "Valid Entries Are..."
echo "Tape Device: rmt0,rmt1,rmt3"
echo "Mail Admin:yes,no"
echo "Backup Type: full,normal,sybase "
while :
do
echo -n -c "\n\n Tape Device To Be Used For This Backup [$_DEVICE] :"
read T_DEVICE
: ${T_DEVICE:=$_DEVICE}
case $T_DEVICE in
rmt0|rmt1|rmt3) break
*) echo "The device are either...rmt0,rmt1,rmt3"
esac
done
# if the user hits return on any of the fields, the default value will be used
while :
do
echo -n "Mail Admin When Done [$_INFORM] : "
read T_INFORM
: ${T_INFORM:=$_INFORM}
case $T_INFORM in
yes|Yes) break
no|No) break
*) echo "The choices are yes,no"
esac
done
while :
do
echo -n "Backup Type [$_TYPE] :"
read T_TYPE
: ${T_TYPE:=$_TYPE}
case $T_TYPE in
Full|full) break
Normal|normal) break
Sybase|sybase) break
*) echo "The choices are either ... full,normal,sybase"
esac
done
# re-assign the temp varialbes back to original variables that
# were loaded in
_DEVICE=$T_DEVICE;_INFORM=$T_INFORM;_TYPE=$T_TYPE
}
show_settings()
{
# display current settings
cat << HH
Default Settings Are...
Tape Device To Be Used : $_DEVICE
Mail Admin When Done : $_INFORM
Type Of Backup : $_TYPE
Log File Of Backup : $_LOGFILE
HH
}
get_code()
{
# users get 3 attempts at entering the correct code
# _CODE is loaded in from the source file
clear
header
_COUNTER=0
echo "YOU MUST ENTER THE CORRECT CODE TO BE ABLE TO CHANGE DEFAULT SETTINGS"
while :
do
_COUNTER=`expr $_COUNTER + 1`
echo -n "Enter the code to change the settings: "
read T_CODE
# echo $_COUNTER
if [ "$T_CODE" = "$_CODE" ];then
return 0
else
if [ "$_COUNTER" -gt 3 ];then
echo "Sorry incorrect code entered, you cannot change the settings..."
return 1
fi
fi
done
}
check_drive()
{
# make sure we can rewind the tape
mt -f /dev/$_DEVICE rewind > /dev/null 2>&1
if [ $? -ne 0 ];then
return 1
else
return 0
fi
}
#====================== main =======================
# can we source the file
check_source
header
# display the loaded in variables
show_settings
# ask user if he/she wants to change any settings
if continue_prompt "Do you wish To Change Some of The System Defaults" "Y";
then
echo $?
# yes then enter code name
if get_code;then
# change some settings
change_settings
fi
fi
#------------------ got settings... now do backup
if check_drive;then
echo "tape OK..."
else
echo "Cannot rewind the tape..Is it in the tape drive???"
echo "check it out"
exit 1
fi
# file system paths to backup
case $_TYPE in
Full|full)
BACKUP_PATH="sybase syb/suppor etc var bin apps usr/local"
Normal|normal)
BACKUP_PATH="etc var bin apps usr/local"
Sybase|sybase)
BACKUP_PATH="sybase syb/suppor"
esac
# now for backup
cd /
echo "Now starting backup......"
find $BACKUP_PATH -print | cpio -ovB -O /dev/$_DEVICE $_LOGFILE 2>&1
# if the above cpio does not work on your system try cpio below, instead
# find $BACKUP_PATH -print | cpio -ovB > /dev/$_DEVICE $_LOGFILE 2>&1
# to get more information on the tape change -ovB to -ovcC66536
if [ "$_INFORM" = "yes" ];then
echo "Backup finished check the log file" | mail admin
fi
2、backup.defaults
复制代码 代码如下:
#!/bin/sh
# backup.defaults
# configuration default file for network backups
# edit this file at your own
# name backup.defaults
# --------------------------------------------
# not necessary for the environments to be in quotes.. but
_CODE="comet"
_LOGFILE="/appdva/backup/log.`date +%y%m%d`"
_DEVICE="rmt0"
_INFORM="yes"
_TYPE="Full"
#---------------------------------------------
continue_prompt()
{
# continue_prompt
# to call: continue_prompt "string to display" default_answer
_STR=$1
_DEFAULT=$2
# check we have the right params
if [ $# -lt 1 ];then
echo "continue_prompt: I need a string to display"
return 1
fi
while :
do
echo -n "$_STR [Y..N] [$_DEFAULT]:"
read _ANS
if [ "$_ANS" = "" ];then
: ${_ANS:=$_DEFAULT}
case $_ANS in
Y) return 0
N) return 1
esac
fi
# user has selected something
case $_ANS in
y|Y|Yes|YES)
return 0
n|N|No|NO)
return 1
*) echo "Answer either Y or N, default is $_DEFAULT"
esac
echo $_ANS
done
}
3、运行:
复制代码 代码如下:
$./backup_run.sh backup.defaults
复制代码 代码如下:
#!/bin/sh
# backup_run
# script to run the backups
# loads in a setting file for the user to change
SOURCE=/home/bob/backup.defaults
check_source()
{
# check_source
# can we load the file
# backup.defaults is the source file containing config/functions
# make sure your path includes this directory you are runing from
if [ -r $SOURCE ];then
. $SOURCE # load $source
else
echo "`basename $0`: cannot locate default file"
exit 1
fi
}
header()
{
# header
USER=`whoami`
MYDATE=`date +%A" "%e" of "%B-%Y`
clear
cat << HH
User: $USER $MYDATE
NETWORK SYSTEM BACKUP
=====================
HH
}
change_settings()
{
# change_settings
# let the user see the default settings..
header
echo "Valid Entries Are..."
echo "Tape Device: rmt0,rmt1,rmt3"
echo "Mail Admin:yes,no"
echo "Backup Type: full,normal,sybase "
while :
do
echo -n -c "\n\n Tape Device To Be Used For This Backup [$_DEVICE] :"
read T_DEVICE
: ${T_DEVICE:=$_DEVICE}
case $T_DEVICE in
rmt0|rmt1|rmt3) break
*) echo "The device are either...rmt0,rmt1,rmt3"
esac
done
# if the user hits return on any of the fields, the default value will be used
while :
do
echo -n "Mail Admin When Done [$_INFORM] : "
read T_INFORM
: ${T_INFORM:=$_INFORM}
case $T_INFORM in
yes|Yes) break
no|No) break
*) echo "The choices are yes,no"
esac
done
while :
do
echo -n "Backup Type [$_TYPE] :"
read T_TYPE
: ${T_TYPE:=$_TYPE}
case $T_TYPE in
Full|full) break
Normal|normal) break
Sybase|sybase) break
*) echo "The choices are either ... full,normal,sybase"
esac
done
# re-assign the temp varialbes back to original variables that
# were loaded in
_DEVICE=$T_DEVICE;_INFORM=$T_INFORM;_TYPE=$T_TYPE
}
show_settings()
{
# display current settings
cat << HH
Default Settings Are...
Tape Device To Be Used : $_DEVICE
Mail Admin When Done : $_INFORM
Type Of Backup : $_TYPE
Log File Of Backup : $_LOGFILE
HH
}
get_code()
{
# users get 3 attempts at entering the correct code
# _CODE is loaded in from the source file
clear
header
_COUNTER=0
echo "YOU MUST ENTER THE CORRECT CODE TO BE ABLE TO CHANGE DEFAULT SETTINGS"
while :
do
_COUNTER=`expr $_COUNTER + 1`
echo -n "Enter the code to change the settings: "
read T_CODE
# echo $_COUNTER
if [ "$T_CODE" = "$_CODE" ];then
return 0
else
if [ "$_COUNTER" -gt 3 ];then
echo "Sorry incorrect code entered, you cannot change the settings..."
return 1
fi
fi
done
}
check_drive()
{
# make sure we can rewind the tape
mt -f /dev/$_DEVICE rewind > /dev/null 2>&1
if [ $? -ne 0 ];then
return 1
else
return 0
fi
}
#====================== main =======================
# can we source the file
check_source
header
# display the loaded in variables
show_settings
# ask user if he/she wants to change any settings
if continue_prompt "Do you wish To Change Some of The System Defaults" "Y";
then
echo $?
# yes then enter code name
if get_code;then
# change some settings
change_settings
fi
fi
#------------------ got settings... now do backup
if check_drive;then
echo "tape OK..."
else
echo "Cannot rewind the tape..Is it in the tape drive???"
echo "check it out"
exit 1
fi
# file system paths to backup
case $_TYPE in
Full|full)
BACKUP_PATH="sybase syb/suppor etc var bin apps usr/local"
Normal|normal)
BACKUP_PATH="etc var bin apps usr/local"
Sybase|sybase)
BACKUP_PATH="sybase syb/suppor"
esac
# now for backup
cd /
echo "Now starting backup......"
find $BACKUP_PATH -print | cpio -ovB -O /dev/$_DEVICE $_LOGFILE 2>&1
# if the above cpio does not work on your system try cpio below, instead
# find $BACKUP_PATH -print | cpio -ovB > /dev/$_DEVICE $_LOGFILE 2>&1
# to get more information on the tape change -ovB to -ovcC66536
if [ "$_INFORM" = "yes" ];then
echo "Backup finished check the log file" | mail admin
fi
2、backup.defaults
复制代码 代码如下:
#!/bin/sh
# backup.defaults
# configuration default file for network backups
# edit this file at your own
# name backup.defaults
# --------------------------------------------
# not necessary for the environments to be in quotes.. but
_CODE="comet"
_LOGFILE="/appdva/backup/log.`date +%y%m%d`"
_DEVICE="rmt0"
_INFORM="yes"
_TYPE="Full"
#---------------------------------------------
continue_prompt()
{
# continue_prompt
# to call: continue_prompt "string to display" default_answer
_STR=$1
_DEFAULT=$2
# check we have the right params
if [ $# -lt 1 ];then
echo "continue_prompt: I need a string to display"
return 1
fi
while :
do
echo -n "$_STR [Y..N] [$_DEFAULT]:"
read _ANS
if [ "$_ANS" = "" ];then
: ${_ANS:=$_DEFAULT}
case $_ANS in
Y) return 0
N) return 1
esac
fi
# user has selected something
case $_ANS in
y|Y|Yes|YES)
return 0
n|N|No|NO)
return 1
*) echo "Answer either Y or N, default is $_DEFAULT"
esac
echo $_ANS
done
}
3、运行:
复制代码 代码如下:
$./backup_run.sh backup.defaults
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月23日
2024年11月23日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]