Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

at job 1

Status
Not open for further replies.

malpa

Technical User
Feb 8, 2004
122
CO
Hi


When I run a bash shell manually, it functions well, but when i run it, using at command i have a problem with the "if" cicle.


#!/usr/bin/bash

/usr/tmc/su - ${USER} <<EOF > ${HOME}/traza.log
at -s -m -f ${PathNewDir}${file}.sh ${HORA} ${A_DATEF[1]} ${A_DATEF[2]},${A_DATEF[4]}
atq
EOF


${PathNewDir}${file}.sh

#!/bin/bash

if [[ -s "$file" ]]; then
echo "OK"
then
echo "not found"
fi

Is it possible to get output of the at command when it is executed??
Is it possible to point the output of the at command, to the log file ??

thanks a lot.

malpa



 
using at command i have a problem
Which problem ?

Anyway you can't have 2 then with a single if but an else.

point the output of the at command, to the log file
/usr/tmc/su - ${USER} <<EOF > ${HOME}/traza.log [!]2>&1[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PVH


The job is programmed in accordance with the date.
When the job run automatically at the time programmed, the programm always execute the else cicle.


Shell that programm the at job

#!/usr/bin/bash

/usr/tmc/su - ${USER} <<EOF > ${HOME}/traza.log
at -s -m -f ${PathNewDir}${file}.sh ${HORA} ${A_DATEF[1]} ${A_DATEF[2]},${A_DATEF[4]}
atq
EOF


************************************
the output of the traza.log file

commands will be excecuted using /bin/sh
job xxxxxxxxxx.a Day Month Day HH:MM:SS YYYY
************************************

Shell executed by at job,

${PathNewDir}${file}.sh

#!/bin/bash

if [[ -s "${PathNewDir}$file" ]]; then
echo "OK"
else
echo "not found"
fi



when job runs automatically with the at command, always point to the "else" cicle, "not found",.
but if i run it manually, it functions well.


Thanks PVH
 

When you execute ${PathNewDir}$file.sh with the "at" command, the variables "${PathNewDir}$file" are undefined inside the executed script.
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top