#!/bin/bash
file1=/tmp/old1_session.sh
file2=/tmp/old2_session.sh
file3=/tmp/old3_session.sh
file4=/tmp/prn_cnt_ses.log
rm $file3 2> /dev/null
rm $file4 2>/dev/null
lpstat -o ULC-CP1-4-SE-11 | head -10 > $file4
if [ ! -s "$file4" ]
then
echo
echo
echo
echo -e "\t\t\t No Stale Printer Session...Found"
echo -e "\t\t\t Bye......"
echo
echo
echo
cat $file4
exit
fi
lpstat -o ULC-CP1-4-SE-11
if [ $# -ne 2 ]
then
echo
echo '<><><>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>'
echo
echo -e "\t\t\t$0 <Date> <Month>...."
echo
echo '<><><><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>'
echo
echo "Bye.........."
tput clear
exit
fi
lpstat -o ULC-CP1-4-SE-11 | grep -i "$1 $2" | grep -v grep | awk -F " " '{print $1}' > $file1
cat $file1 | awk -F "-" '{print $6}' | while read line
do
echo "lprm $line" >> $file2
done
mv $file2 $file3
echo
echo
echo '<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
echo '<>><><<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>'
echo '<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
echo
echo
echo "========="
echo "List of $1 $2 Printer Session"
echo "=========="
echo
echo
cat $file3
echo "==================================================================="
echo "To Remove Above Printer Session Please run below Script"
echo
echo "SYNTAX << . $file3 >>......"
echo
No comments:
Post a Comment