Cronjob setting

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Cronjob setting
# 8  
Old 03-20-2012
Newbie: Intro to cron

Using cron

Cron and Crontab usage and examples

Code:
Minute   Hour   Day of Month       Month          Day of Week        Command  
*/5       0         *                *                *             <command>

# 9  
Old 03-20-2012
@hedkandi

Just realised that your original cron from post #1 must have been running the script every 5 minutes and therefore appending to the output file every 5 minutes. So if you look at 11:00 local time the timestamp changes ... and again at 11:05 etc. . There is nothing obvious wrong with the timestamp on that file unless it wasn't 11:00 when you looked.

What are you trying to do and what is your expected output?
This User Gave Thanks to methyl For This Post:
# 10  
Old 03-22-2012
Hi methyl, ygemici

Im trying to get memory reading with the ps command every 5 minutes, 24 hours a day unless the system is down (its set up with S'pore time zone). Since the previous 2 cron settings didn't work, so I edited the cron to run 5 mins and all other paramaters set as * :

Code:
[root@EP-WCRM1 03]# ls -lrt
total 572
-rw-r--r--. 1 root root 206521 Mar 19 23:55 2012-03-19
-rw-r--r--. 1 root root 186589 Mar 20 12:15 2012-03-20
-rw-r--r--. 1 root root  82800 Mar 21 23:55 2012-03-21--------working!
-rw-r--r--. 1 root root  85050 Mar 22 15:40 2012-03-22

and this is how my cronjob looks like now:

Code:
##Run memory report every 5 mins daily
*/5 * * * * /usr/local/bin/MEM_Report/MEM_daily_run

Also, there's another script that creates an empty report file every day at 1min past midnight:

Code:
##Create daily memory log
01 00 * * * /usr/local/bin/MEM_Report/MEM_day_log

This is the expected result, which is like totally working now!
Code:
[root@EP-WCRM1 03]# more 2012-03-22
  PID USER         TIME COMMAND         %MEM
20110 root     00:00:19 scanner          3.1
 6320 root     00:08:05 nailslogd        0.7
28559 root     00:01:25 httpd            0.5
 6491 root     00:00:05 logepo           0.5
 6416 root     00:21:45 kdm_greet        0.4
25053 root     00:00:30 plasma-desktop   0.4
24783 root     00:00:05 Xvnc             0.3
25027 root     01:43:34 knotify4         0.3
25017 root     00:00:06 kded4            0.2
  PID USER         TIME COMMAND         %MEM

THANK YOU ALL!! Smilie

Last edited by hedkandi; 03-22-2012 at 05:01 AM.. Reason: correction
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cronjob

How to set cronjob for 48 hours. I can set for 2 days as shown below. * * */2 * * It is creating confusion for 30 days & 31 days per month. (3 Replies)
Discussion started by: Nishit
3 Replies

2. Solaris

Is there a difference between setting a user as nologin and setting it as a role?

Trying to figure out the best method of security for oracle user accounts. In Solaris 10 they are set as regular users but have nologin set forcing the dev's to login as themselves and then su to the oracle users. In Solaris11 we have the option of making it a role because RBAC is enabled but... (1 Reply)
Discussion started by: os2mac
1 Replies

3. UNIX for Advanced & Expert Users

Help with cronjob setting

Hi everyone, I have set a cronjob to run every 5 minutes. But this has to be stopped between 1:00AM to 3:00AM. How do I do it? (3 Replies)
Discussion started by: VidyaVenugopal
3 Replies

4. UNIX for Dummies Questions & Answers

cronjob

Is the cronjob below can run only first wednesday of every month? 30 5 1-7 * 3 command please tell me (3 Replies)
Discussion started by: Anjan1
3 Replies

5. UNIX for Dummies Questions & Answers

Cronjob help

Hi I am very new to linux. I want to run a cronjob every 15 minutes that checks a directory for files. If the directory contains more than ten files I want it to send an email to me. All I have is this... */15 * * * * ls -l | wc -l | | mail -s "This is just a test" I would... (2 Replies)
Discussion started by: LinuxNewb
2 Replies

6. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

7. Fedora

Setting up Cronjob

Hi, I had to setup some cron jobs using crontab -e when logged in as root. I noticed that the jobs only run when the permissons on the shell script file are set to execute on root and other. Why does "other" have to have its execution permission set? (6 Replies)
Discussion started by: mojoman
6 Replies

8. Shell Programming and Scripting

Cronjob

Hi, I'm totally new to shell scripting. I need help in my crontab script. I'm trying to read some values from user (username, log file directory, server) and then use those value to create a crontab for log rotation after some interval of time. creating crontabs manually isn't big deal.... (11 Replies)
Discussion started by: MisterKhan
11 Replies

9. Solaris

at vs cronjob

HI, What is the differnece between at / con job? thanks in advance. (1 Reply)
Discussion started by: mokkan
1 Replies

10. Shell Programming and Scripting

Cronjob

Please can someone help me. I need to set up a cron job to measure CPU usage, Disk I/O and memory usage over a period of 1 minute along with the number of users logged into the system. I also need to send it to another user besides myself every hour. Please can someone help me! Thanks. (4 Replies)
Discussion started by: gerwhelan
4 Replies
Login or Register to Ask a Question