crontab in AIX


 
Thread Tools Search this Thread
Operating Systems AIX crontab in AIX
# 22  
Old 11-27-2006
Sorry. Actually when i say it works, this means all the suggestions above given work. that's why i did not specify which exact one works. You can use cat /dev/null or cp /dev/null. The mistake i made was with the timing. I did not know that a * means every minute. I put 1 * * * * this means every first minute (only) of every hour that is why i do not get the output as i need to wait for the next hour to get another 1 minute output. But now there is a question. Is there anyway to do a one-whole-day reporting? In other words, from 7am today till 6.59 am tomorrow. I did it this way:
* * * * * /usr/lib/sa/sa1 60 60 &
5 9 * * * /usr/lib/sa/sa2 -s 9:00 -e 8:59 -A &

I do not raelly know what it means exactly in the first line. But, 2nd line should mean at 9.05am every day, produce the output of sa2 where it will start recording the activity from 9am till 8.59am the next day. Is there any mistake?
# 23  
Old 11-27-2006
The first line works because it's running every minute of every day and the program being called accepts passed parameters that control what actually happens when. When I write programs that have the capability of checking date/time for acting on whatever, I usually have it do something very different from the schedule cron runs, ie:

If a program runs every Monday morning, but only if there's data to collect and act on, then Cron runs every Monday morning and the program checks for the data being present. Actually that example is a no-brainer.... It's Monday and I don't drink coffee. But, I hope that gives some semblance of understanding.

The above example, poor as it is, should also apply to your second line.

Oh, I just noticed the '&' at the end of the lines. If the called programs run once and then die, cron needs to be set to run often. If they run forever, then cron doesn't need to be run so often. In that case, the called programs should have a PID file in /var/run to check against. If the file is there and the PID is active, then the program isn't run, else it is run.

HTH,
# 24  
Old 11-27-2006
Hi Kpearson, forgive me for being slow but i do not really understand what you tried to convey in your message. Maybe i should tell you what i am trying to achieve with the sa reporting. I would like to do a reporting on all cpu activities for the whole day and print it to a file at the end of the day. Therefore, you see the time is -s 9:00 and -e 8:59 (which is supposed to be the next day) and the report should be produced at 9:05 the next day. How do i do a reporting for one whole day because the default for sar is to do reporting from 8am till 6pm.
# 25  
Old 11-27-2006
Oh, in that case, I'd write a script that looks something like:

#!/usr/bin/ksh (I use ksh on AIX unless bash is available)
checkdate () {
CHKDT=`date`
CHKDT=`echo $CHKDT|perl -pe 's/ / /eg'` ;# remove extra spaces
CHKDATE=`echo $CHKDT|cut -f3 -d' '`
CHKTM=`echo $CHKDT|cut -f4 -d' '`
CHKHR=`echo $CHKTM|cut -f1 -d':'`
CHKMIN=`echo $CHKTM|cut -f2 -d':'`
}

FL=/path/to/capture/file
sar -desired_options >> $FL

checkdate
if [ "$CHKHR" = 9 ] &&
[ "$CHKMIN" = 59 ] ; then
cp $FL $FL"_"$CHKDATE
cat /dev/null > $FL
fi

exit 1


Okay, it's rough, but perhaps it will give you some ideas...
# 26  
Old 12-05-2006
Phew, kpearson that is really tough to comprehend. But why is a script required? Is the sa1 and sa2 command not sufficient to give me the output i want? My output has been very inconsistent. Is there anything wrong with the two lines i added into my crontab?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Samba 3.6 on AIX 7.1 - Windows 10 Access to AIX file shares using Active Directory authentication

I am running AIX 7.1 and currently we have samba 3.6.25 installed on the server. As it stands some AIX folders are shared that can be accessed by certain Windows users. The problem is that since Windows 10 the guest feature no longer works so users have to manually type in their Windows login/pwd... (14 Replies)
Discussion started by: linuxsnake
14 Replies

2. AIX

Will it affect my AIX LPAR security, when i set up email alerts on AIX server.

Hello, I've set up email alerts on AIX Servers. so that i can get email notifications (via mail relay server) when ever there is abnormal behavior. for example 1) my script monitors CPU/disk/memory etc... when it reaches high water ark, it will send an email alert. 2) disk usage alerts 3)... (5 Replies)
Discussion started by: System Admin 77
5 Replies

3. AIX

Nim on AIX 7.1 used to migrate AIX 5.3 to AIX 6.1...is possible?

Using nimadm: nimadm -j nimadmvg -c sap024 -s spot_6100 -l lpp_6100 -d "hdisk1" -Y Initializing the NIM master. Initializing NIM client sap024. 0505-205 nimadm: The level of bos.alt_disk_install.rte installed in SPOT spot_6100 (6.1.3.4) does not match the NIM master's level (7.1.1.2).... (2 Replies)
Discussion started by: sciacca75
2 Replies

4. 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

5. AIX

How to upgrade AIX Firmware & TL Maintenance Level in AIX

Steps to upgrade AIX TL ( technology Level ) / Maintenance Level in AIX ( including Firmware HMC VIOS ) This article or post covers upgrades for - Hardware Management Console ( HMC ) - Firmware ( also known as microcode ) - VIO ( Virtual I/O Server = PowerVM ) - AIX Version, Technology... (2 Replies)
Discussion started by: filosophizer
2 Replies

6. 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

7. UNIX for Dummies Questions & Answers

Crontab problem in AIX

Hi my script is as below. #! /bin/sh get=`ls -l *.ZIP | egrep -c '^-'` put=`cat Get_File_Count.txt|grep ''` if 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... (8 Replies)
Discussion started by: naveen.kuppili
8 Replies

8. AIX

IY17981 fix required for aix 4.3.3 to aix 5L migration but not found

Hi, redbook documentation is telling that IY17981 fix is required for aix 4.3.3 to aix 5L migration. But there is no mention about that fix in any ML installation packages. - My system is ML11 : oslevel –r 4330-11 - But xlC.rte is on wrong version : lslpp -L xlC.rte xlC.rte ... (3 Replies)
Discussion started by: astjen
3 Replies

9. AIX

How to apply aix 5.3 TL8 properly on ML5 aix system ?

Is it necessary to put system into single user mode for applying aix 5.3 TL8 on a aix 5.3.5.0 system ? Is the TL8 installation not totally safe ? thank you. (6 Replies)
Discussion started by: astjen
6 Replies
Login or Register to Ask a Question