How to suspend all schedules

Robert_Cody

ADSM.ORG Member
Joined
Jul 20, 2004
Messages
22
Reaction score
0
Points
0
Website
http
PREDATAR Control23

How would one suspend all of the scheduled tasks? Must I update them all to a week in the future? I know I can "disable sessions", but this won't stop my migration, backup db etc. scheduled tasks. Thanks!
 
PREDATAR Control23

This option must set placed in the dsmserv.opt file:



DISABLESCHEDS YES





You have to stop and start the server service (dsmserv) after the change.
 
PREDATAR Control23

When we need to turn off schedules and process we use the following three lines in our DSMSERV.OPT



NOMIGRRECL

EXPINTERVAL 0

DISABLESCHEDS YES



The first turns off all migration and reclamation processes

The second shuts off expiration

The third disables all schedules
 
PREDATAR Control23

mateinone , is it a generic script or you got to re-edit it?
 
PREDATAR Control23

generic mate

You just take a snapshot of all schedules and then set all to expiren afterwards we reset all back to never expire

we use for client schedules, but dead easy to add admin schedules in as well...

I am not at work at the moment, but would probably take 20 minutes to knock up another one, if people want it
 
Last edited:
PREDATAR Control23

sorry about this took a little while to get around to this again, been a busy week.

Now there were a couple of bugs in the first script, just little ones I put in there so I could test when I got on a system, but did not remove as part of the post...


Here are a couple of scripts.. One is a disable, the other an enable
 
PREDATAR Control23

DISABLE SCHEDULES

#!/usr/bin/ksh

clear

usage()
{
echo "\n\tUsage: `basename $0` [ options ... ] "
echo "\tOptions:"
echo "\t\t-h help"
echo "\t\t-a Expire Admin Schedules"
echo "\t\t-c Expire Client Schedules"
echo "\t\t-? usage"
echo ""
exit 1
}

if [[ $# -eq 0 ]]
then
echo No Arguments Selected
usage
fi

help_data(){
echo "\trestart_tsm.ksh"
echo
echo "\tThis script disables schedules on the TSM Server"
echo "\tIf run without any arguments the script will exit without performing any tasks"
echo "\tThe following options are valid"
echo
echo "\t\t-a Expire Admin Schedules"
echo "\t\t-c Expire Client Schedules"
echo
echo "\tAn example below would expire both Client and Admin Schedules"
echo
echo "\t`basename $0` -c -a "
return 0;
}

ADMIN=NO
CLIENT=NO

while getopts "hac" name
do
case $name in
h) help_data
;;
a) ADMIN="YES"
;;
c) CLIENT="YES"
;;
*) usage
;;
esac
done

REP_DIR="/your/report/dir/"
SERVER="yourtsmserver"
TSM_PSWD=/yourpassdir/yourpassfile
date_ext=`date '+%Y%m%d'`
ADMIN_REP="${REP_DIR}adminsched.${date_ext}"
CLIENT_REP="${REP_DIR}clientsched.${date_ext}"
TSM_CMD=dsmadmc
read ID PASSWORD < ${TSM_PSWD}
tsmCMD="${TSM_CMD} -id=${ID} -pa=${PASSWORD} -comma -dataonly=yes -se=${SERVER}"


rc_chk () {
RC=`echo $?`
if [[ $RC -ne "0" && $RC -ne "11" ]]
then
echo ""
echo "\tExiting... Return Code $RC"
exit $RC;
fi
}

if [[ $CLIENT = YES ]]
then
CLIENT_CNT=0
CSCHED=`$tsmCMD "select domain_name, schedule_name, expiration from Client_Schedules"`
rc_chk
for csched in $CSCHED
do
EXPIRE=`echo $csched|awk -F , '{print $3}'`
if [[ -n $EXPIRE ]]
then
CLIENT_CNT=`expr $CLIENT_CNT + 1`
fi
echo $csched |awk -F, '{print $1,$2,"exp=01/01/2007"}'|xargs -I {} $tsmCMD "upd sched {}"
rc_chk
done

if [[ $CLIENT_CNT -gt "0" ]]
then
echo DATE_EXPIRY > $CLIENT_REP
echo "$CSCHED" >> $CLIENT_REP
else
echo "$CSCHED" > $CLIENT_REP
fi
if [[ -s $CLIENT_REP ]]
then
echo Client Schedule file $CLIENT_REP created
fi
fi



if [[ $ADMIN = YES ]]
then
ADMIN_CNT="0"
ASCHED=`$tsmCMD "select schedule_name, expiration from admin_schedules"`
rc_chk
for asched in $ASCHED
do
EXPIRE=`echo $asched|awk -F , '{print $2}'`
if [[ -n $EXPIRE ]]
then
ADMIN_CNT=`expr $ADMIN_CNT + 1`
fi
echo $asched |awk -F, '{print $1,"exp=01/01/2007"}'|xargs -I {} $tsmCMD "upd sched type=admin {}"
rc_chk
done

if [[ $ADMIN_CNT -gt "0" ]]
then
echo DATE_EXPIRY > $ADMIN_REP
echo "$ASCHED" >> $ADMIN_REP
else
echo "$ASCHED" > $ADMIN_REP
fi
if [[ -s $ADMIN_REP ]]
then
echo Admin Schedule file $ADMIN_REP created
fi
fi
 
Last edited:
PREDATAR Control23

ENABLE SCHEDS

#!/usr/bin/ksh

clear

usage()
{
echo "\n\tUsage: `basename $0` [ options ... ] "
echo "\tOptions:"
echo "\t\t-h help"
echo "\t\t-a Enable Admin Schedules"
echo "\t\t-c Enable Client Schedules"
echo "\t\t-? usage"
echo ""
exit 1
}

if [[ $# -eq 0 ]]
then
echo No Arguments Selected
usage
fi

help_data(){
echo "\trestart_tsm.ksh"
echo
echo "\tThis script enables schedules on the TSM Server"
echo "\tIf run without any arguments the script will exit without performing any tasks"
echo "\tThe following options are valid"
echo
echo "\t\t-a Enable Admin Schedules"
echo "\t\t-c Enable Client Schedules"
echo
echo "\tAn example below would enable both Client and Admin Schedules"
echo
echo "\t`basename $0` -c -a "
return 0;
}

ADMIN=NO
CLIENT=NO

while getopts "hac" name
do
case $name in
h) help_data
;;
a) ADMIN="YES"
;;
c) CLIENT="YES"
;;
*) usage
;;
esac
done

REP_DIR="/your/report/dir/"
SERVER="yourtsmserver"
TSM_PSWD=/yourpassdir/yourpassfile
date_ext=`date '+%Y%m%d'`
ADMIN_REP="${REP_DIR}adminsched"
CLIENT_REP="${REP_DIR}clientsched"
TSM_CMD=dsmadmc
read ID PASSWORD < ${TSM_PSWD}
tsmCMD="${TSM_CMD} -id=${ID} -pa=${PASSWORD} -comma -dataonly=yes -se=${SERVER}"


rc_chk () {
RC=`echo $?`
if [[ $RC -ne "0" && $RC -ne "11" ]]
then
echo ""
echo "\tExiting... Return Code $RC"
exit $RC;
fi
}

if [[ $CLIENT = YES ]]
then
LASTCLIENT=`ls -tr ${CLIENT_REP}*|tail -1`
if [[ -f $LASTCLIENT ]]
then
ENABLECLIALL=`head -n 1 $LASTCLIENT|awk '{print $1}`
if [[ $ENABLECLIALL != "DATE_EXPIRY" ]]
then
awk -F, '{print "upd sched ",$1,$2" exp=never"}' $LASTCLIENT|tail +2|xargs -I {} $tsmCMD "{}"
rc_chk
else
ENABLEC=`tail +2 $LASTCLIENT`
for enablec in $ENABLEC
do
EXPCHKC=`echo $enablec|awk -F, '{print $3}'`
if [[ -n $EXPCHKC ]]
then
echo $enablec |sed s/,/" "/g|awk '{print $1,$2" exp="$3}'|xargs -I {} $tsmCMD "upd sched {}"
rc_chk
else
echo $enablec |sed s/\,/" "/g|awk '{print $1,$2" exp=never"}'| xargs -I {} $tsmCMD "upd sched {}"
rc_chk
fi
done
fi
else
echo problem with last file
fi

fi

echo

if [[ $ADMIN = YES ]]
then
LASTADMIN=`ls -tr ${ADMIN_REP}*|tail -1`
if [[ -f $LASTADMIN ]]
then
ENABLEADMALL=`head -n 1 $LASTADMIN|awk '{print $1}`
if [[ $ENABLEADMALL != "DATE_EXPIRY" ]]
then
awk -F, '{print "upd sched ",$1," type=admin exp=never"}' $LASTADMIN|tail +2|xargs -I {} $tsmCMD "{}"
rc_chk
else
ENABLEA=`tail +2 $LASTADMIN`
for enablea in $ENABLEA
do
EXPCHKA=`echo $enablea|awk -F, '{print $2}'`
if [[ -n $EXPCHKA ]]
then
echo $enablea |sed s/,/" "/g|awk '{print $1,"type=admin exp="$2}'|xargs -I {} $tsmCMD "upd sched {}"
rc_chk
else
echo $enablea |sed s/\,/" "/g|awk '{print $1,"type=admin exp=never"}'| xargs -I {} $tsmCMD "upd sched {}"
rc_chk
fi
done
fi
else
echo problem with last file
fi
fi
 
Last edited:
PREDATAR Control23

Just one more thing

I did mention it earlier, but the following need to be modified to suit your system

REP_DIR="/your/report/dir/"
SERVER="yourtsmserver"
TSM_PSWD=/yourpassdir/yourpassfile

also there are two entries as follows

echo problem with last file

Just replace with an error message which informs that you do not have a file to work from.
This will come if you try to enable the schedules, but never done a disable.

The disable job creates a file for the enable job.
 
Last edited:
PREDATAR Control23

hi ,how to learn these scripts is bash shell/korn shell/phython..
 
Top