Crontab problem in AIX


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Crontab problem in AIX
# 1  
Old 05-22-2009
Crontab problem in AIX

Hi my script is as below.

Code:
#! /bin/sh
get=`ls -l *.ZIP | egrep -c '^-'`
put=`cat Get_File_Count.txt|grep '[0-9]'`
if [ $get -gt $put ]
then
echo $get > Get_File_Count.txt
echo "Hi,\n\nYou've got a new feed!\n\nFilename : `ls -l *.ZIP|sort -k 6|tail -1|cut -c 58-90`" | mail -s "New File Received" user@domain.com
else
echo "No new File"
fi

When i run the script it is running perfectly.

I included the above script in crontab.

Code:
MAILTO="user@domain.com"
30 * * * * /usr/informatica/test/infa_shared/SrcFiles/Get_New.sh >/dev/null 2>&1

But i am not getting any mail and also the script is not executing every 30 minutes Smilie

Last edited by Don Cragun; 06-06-2016 at 01:15 AM.. Reason: Add CODE tags.
# 2  
Old 05-22-2009
try adding this line after first line in your script
. $HOME/.profile
# 3  
Old 05-22-2009
Quote:
Originally Posted by vidyadhar85
try adding this line after first line in your script
. $HOME/.profile
Yes,i added it after
#! /bin/sh
is it ok.
# 4  
Old 05-22-2009
Hi!
Why don't you put a statement.
MAILTO="user@domain.com"
in the Get_News.sh script file.
since this parameter can feed to the mail -s command when this script is executed by cron process.

refere to
http://www.panix.com/~kylet/unix-att.html

Last edited by tom_cmu; 05-22-2009 at 02:30 AM..
# 5  
Old 05-22-2009
Quote:
Originally Posted by vidyadhar85
try adding this line after first line in your script
. $HOME/.profile
Still its not getting executed Smilie
# 6  
Old 05-22-2009
is this "Get_File_Count.txt" file getting created??
# 7  
Old 05-22-2009
Quote:
Originally Posted by vidyadhar85
is this "Get_File_Count.txt" file getting created??
Yes.It gets a value as per the script.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crontab on AIX

Hi I'm trying to set up a crontab on AIX and for some reason it's not running my script at the specified time - here's what I have tried so far: 30 14 * * * <scriptname> 35 14 *** /directory/<scriptname> 40,14 *** /directory/<scriptname> (nb crontab won't accept the comma) 1 and 2... (10 Replies)
Discussion started by: dbchud
10 Replies

2. Solaris

Crontab Problem

Dear All I have machine with SunOS APP5a 5.9 Generic_122300-19 sun4u sparc SUNW,Sun-Fire With crontab like this : 59 23 * * * /home/lng/script/move_and_compress_logs_update.sh But that crontab cannot running at that time. I run my script by manually, the result is fine. What must I check at... (5 Replies)
Discussion started by: mbah_jiman
5 Replies

3. Solaris

crontab problem

online* 22:25:22 svc:/system/cron:default cron service not able to start i tried to disble it is not working. showing online* status. thanks (1 Reply)
Discussion started by: sunnybee
1 Replies

4. Shell Programming and Scripting

Problem with crontab

Hi, I have one script which takes data from table and spools it into a file. When i am running manually all is fine but while trying same script thru crontab the spooled file is not getting generated..... :confused: The mail part is working fine....only prob is the spooled file. Please... (15 Replies)
Discussion started by: fidelis
15 Replies

5. Shell Programming and Scripting

Sed or Awk for modify hour in a crontab AIX

Hi, I want to modifiy the hour in the crontab AIX 5.3 for this line: Input: 00 22 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1 Output: 30 20 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1 With the awk or sed function through a ssh -q... (1 Reply)
Discussion started by: khalidou13
1 Replies

6. Solaris

Crontab problem

Hi all, Why my crontab -e from root user is not accessible? It came out some sort of random number, 309. And also for other user, crontab -l came out crontab: can't open your crontab file. I'm grateful for any any help. thanks. (9 Replies)
Discussion started by: beginningDBA
9 Replies

7. AIX

Crontab problem

Hi to all. Guys, i have a truble with oracle user crontab. He work if i'm do 0-59 * * * * echo LOL> ~/test.txt But not work if me set realy norm date For example 14 17 28 12 * echo LOL> ~/test.txt In 17:14 28 December . In log file /var/adm/cron/log nothing.... Please... (3 Replies)
Discussion started by: jess_t03
3 Replies

8. UNIX for Advanced & Expert Users

crontab problem

hi all while using crontab -e im receiving 754 as output im unable to add a entry in crontab crontab -l is working fine OS: sun5.8 can some one please assist me (4 Replies)
Discussion started by: NIMISH AGARWAL
4 Replies

9. AIX

crontab in AIX

Hi all, i am trying to reduce the file size of /var/adm/wtmp in my AIX servers and im using the method cp /dev/null /var/adm/wtmp to reduce it. I thought of automating it by including this command into crontab. Surprisingly, it doesn't work once i put into crontab, there is no error message thrown... (25 Replies)
Discussion started by: smallbook
25 Replies

10. Shell Programming and Scripting

crontab problem

HI, i am working on linux. i have crontab problem i wrote a small script and put it in a crontab . but the script is not running.. i have given following way in crontab -e 02 06 * * * /bin/csh /home/vr_test.csh but the above script is not running please rectify my... (26 Replies)
Discussion started by: rajan_ka1
26 Replies
Login or Register to Ask a Question