Must be a Monday !! I am having problems with the following script . The script runs correctly when I manually run the script.
When I put the script in a cron Job It kicks out at the @ MP=$MN / 6 . For some reason it does not like the @ MP =$MN /6. Is there antoher way rto write this in order for it to work correctly in a cron job?
Thanks in advance,
I guess I just had tooomuch fun this weekend brain is not working.
# !/bin/csh
# set variables for login devices
set PMA = "pm1"
set PMB = "pm3"
#get a count for the number of users , excluding dedicated users.
set PA = `/usr/local/bin/pmwho $PMA |grep -v W1|grep -v Port|grep -v "[-]"|wc -l`
set PB = `/usr/local/bin/pmwho $PMB |grep -v W1|grep -v -v Port|grep -v "[-]"|wc -l`
# Set time and date variables
set HR = `/bin/date '+%H'`
set MN = `/bin/date '+%M'`
set DT = `/bin/date '+%m/%d/%y'`
set BX = `/bin/date '+%m'`
set BY = `/bin/date '+%y'`
set BZ = `/bin/date '+%d'`
# Convert the minutes into percentage format for easier handling
@ MP=$MN / 6
# Start a new file if it is midnight
if ($HR == 00 && $MN <= 09 ) then
cat /dev/null > /usr/local/pm/pm1.log
cat /dev/null > /usr/local/pm/pm3.log
endif
# Put the numbers into the log file.
echo $HR"."$MP " " $PA " " >> /usr/local/pm/pm1.log
echo $HR"."$MP " " $PB " " >> /usr/local/pm/pm3.log
endif
When I put the script in a cron Job It kicks out at the @ MP=$MN / 6 . For some reason it does not like the @ MP =$MN /6. Is there antoher way rto write this in order for it to work correctly in a cron job?
Thanks in advance,
I guess I just had tooomuch fun this weekend brain is not working.
# !/bin/csh
# set variables for login devices
set PMA = "pm1"
set PMB = "pm3"
#get a count for the number of users , excluding dedicated users.
set PA = `/usr/local/bin/pmwho $PMA |grep -v W1|grep -v Port|grep -v "[-]"|wc -l`
set PB = `/usr/local/bin/pmwho $PMB |grep -v W1|grep -v -v Port|grep -v "[-]"|wc -l`
# Set time and date variables
set HR = `/bin/date '+%H'`
set MN = `/bin/date '+%M'`
set DT = `/bin/date '+%m/%d/%y'`
set BX = `/bin/date '+%m'`
set BY = `/bin/date '+%y'`
set BZ = `/bin/date '+%d'`
# Convert the minutes into percentage format for easier handling
@ MP=$MN / 6
# Start a new file if it is midnight
if ($HR == 00 && $MN <= 09 ) then
cat /dev/null > /usr/local/pm/pm1.log
cat /dev/null > /usr/local/pm/pm3.log
endif
# Put the numbers into the log file.
echo $HR"."$MP " " $PA " " >> /usr/local/pm/pm1.log
echo $HR"."$MP " " $PB " " >> /usr/local/pm/pm3.log
endif