Sponsored Content
Full Discussion: Crontab on hourly basis
Top Forums Shell Programming and Scripting Crontab on hourly basis Post 302765021 by Optimus81 on Friday 1st of February 2013 10:05:54 AM
Old 02-01-2013
here is the small explaination.
Code:
1 2 3 4 5 /root/backup.sh
 Where,
¦1: Minute (0-59)
¦2: Hours (0-23)
¦3: Day (0-31)
¦4: Month (0-12 [12 == December])
¦5: Day of the week(0-7 [7 or 0 == sunday])
¦/path/to/command - Script or command name to schedule
Easy to remember format:
* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
here a good comparison table i use to make it easy Format Meaning 
0 0 1 1 * Run once a year 
0 0 1 * * Run once a month 
0 0 * * 0 Run once a week 
0 0 * * * Run once a day 
0 * * * * Run once an hour

and
Code:
@yearly (or @annually) Run once a year, midnight, Jan. 1st 0 0 1 1 * 
@monthly Run once a month, midnight, first of month 0 0 1 * * 
@weekly Run once a week, midnight on Sunday 0 0 * * 0 
@daily Run once a day, midnight 0 0 * * * 
@hourly Run once an hour, beginning of hour 0 * * * * 
@reboot Run at startup @reboot

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do you automate an hourly file check?

Hi, New to the forum, Great site, I can learn a lot from here!! :cool: I would like to know how to automate a command that checks the Sybase database's are "alive" on an hourly basis, and mails outlook if they are not (1 Reply)
Discussion started by: mals
1 Replies

2. Red Hat

hourly kannel log rotation

I need to Change threshold of rotation of kannel logs. At the moment, Kannel (the SMS gateway system) logs activities in log files which are rotated daily. Due to high traffic, the logs grow fast every day before they are rotated; meaning that the write speeds while logging slow down due to large... (2 Replies)
Discussion started by: Targ
2 Replies

3. Solaris

Monitoring the output of 'top' command on hourly basis.

I need to capture the following data on an hourly basis through cronjob scheduling:- 1. load averages 2. Total no. of processes. 3. CPU state 4. Memory 5. Top 3 process details. All the above information is available through the command 'top'. But here we need to automate the same and... (4 Replies)
Discussion started by: subharai
4 Replies

4. UNIX for Dummies Questions & Answers

Maintaining HOURLY backups

I have a system where i take hourly back-ups of the system.The script for maintaining full backup for the last 5 days is find /backup/server -type f -mtime +4 -exec rm -f {} \; works fine for keeping the files of some 5 days old. In the case of hourly backups.How do we write to keep... (2 Replies)
Discussion started by: ravi55055
2 Replies

5. Shell Programming and Scripting

how to grep string from hourly basis files

dear all, pls help on this script.. i have many files which will be created every mins in particular directory. i want to grep a particular string from only for unique hour files. from the below code i want to grep a string from only 9th hour files . Ex files: -rw-r--r-- 1 root ... (5 Replies)
Discussion started by: steve2216
5 Replies

6. UNIX for Advanced & Expert Users

Problems with hourly removal in cron

In my cron job on one system I have log files removed older than 3 days, like so: find /u01/arch/PRD8 -mtime +3 -a -name "*.log" -exec rm {} \; On another system I would like to check and remove anything older than 2 hours. Any help would be greatly appreciated :wall: (7 Replies)
Discussion started by: georgia
7 Replies

7. Shell Programming and Scripting

FTP a file on Hourly basis

Hi, I have to upload a file test_201105281100.txt to a ftp location. The files will be created on hourly basis like test_201105281100.txt, test_201105281200.txt & so on. After a file is uploaded successfully, I need to rename the file as test_201105281100.success & if it is not uploaded... (11 Replies)
Discussion started by: SunilB2011
11 Replies

8. Shell Programming and Scripting

Hourly averaging using Awk

Hey all, I have a set of 5-second data as shown below. I need to find an hourly average of this data. date co2 25/06/2011 08:04:00 8.30 25/06/2011 08:04:05 8.31 25/06/2011 08:04:10 8.32 25/06/2011 08:04:15 8.33 25/06/2011 08:04:20 ... (5 Replies)
Discussion started by: gd9629
5 Replies

9. Shell Programming and Scripting

Calculate avg response time on hourly basis

Hi, I am trying to calculate avg response time on hourly basis from the log file which has millions of records. As of now I am trying with creating temp file which will have lines with unique id and start time and end time and after that another script will run on this temp file to... (7 Replies)
Discussion started by: random_thoughts
7 Replies
clock(n)						       Tcl Built-In Commands							  clock(n)

__________________________________________________________________________________________________________________________________________________

NAME
clock - Obtain and manipulate time SYNOPSIS
clock option ?arg arg ...? _________________________________________________________________ DESCRIPTION
This command performs one of several operations that may obtain or manipulate strings or values that represent some notion of time. The option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are: clock clicks ?-milliseconds? | Return a high-resolution time value as a system-dependent integer value. The unit of the value is system-dependent but should be | the highest resolution clock available on the system such as a CPU cycle counter. If -milliseconds is specified, then the value is | guaranteed to be of millisecond granularity. This value should only be used for the relative measurement of elapsed time. clock format clockValue ?-format string? ?-gmt boolean? Converts an integer time value, typically returned by clock seconds, clock scan, or the atime, mtime, or ctime options of the file command, to human-readable form. If the -format argument is present the next argument is a string that describes how the date and time are to be formatted. Field descriptors consist of a % followed by a field descriptor character. All other characters are copied into the result. Valid field descriptors are: %% Insert a %. %a Abbreviated weekday name (Mon, Tue, etc.). %A Full weekday name (Monday, Tuesday, etc.). %b Abbreviated month name (Jan, Feb, etc.). %B Full month name. %c Locale specific date and time. %d Day of month (01 - 31). %H Hour in 24-hour format (00 - 23). %I Hour in 12-hour format (00 - 12). %j Day of year (001 - 366). %m Month number (01 - 12). %M Minute (00 - 59). %p AM/PM indicator. %S Seconds (00 - 59). %U Week of year (00 - 52), Sunday is the first day of the week. %w Weekday number (Sunday = 0). %W Week of year (00 - 52), Monday is the first day of the week. %x Locale specific date format. %X Locale specific time format. %y Year without century (00 - 99). %Y Year with century (e.g. 1990) %Z Time zone name. In addition, the following field descriptors may be supported on some systems (e.g. Unix but not Windows): %D Date as %m/%d/%y. %e Day of month (1 - 31), no leading zeros. %h Abbreviated month name. %n Insert a newline. %r Time as %I:%M:%S %p. %R Time as %H:%M. %t Insert a tab. %T Time as %H:%M:%S. If the -format argument is not specified, the format string "%a %b %d %H:%M:%S %Z %Y" is used. If the -gmt argument is present the next argument must be a boolean which if true specifies that the time will be formatted as Greenwich Mean Time. If false then the local timezone will be used as defined by the operating environment. clock scan dateString ?-base clockVal? ?-gmt boolean? Convert dateString to an integer clock value (see clock seconds). This command can parse and convert virtually any standard date and/or time string, which can include standard time zone mnemonics. If only a time is specified, the current date is assumed. If the string does not contain a time zone mnemonic, the local time zone is assumed, unless the -gmt argument is true, in which case the clock value is calculated assuming that the specified time is relative to Greenwich Mean Time. -gmt, if specified, affects only the computed time value; it does not impact the interpretation of -base. If the -base flag is specified, the next argument should contain an integer clock value. Only the date in this value is used, not the time. This is useful for determining the time on a specific day or doing other date-relative conversions. The dateString consists of zero or more specifications of the following form: time A time of day, which is of the form: hh?:mm?:ss?? ?meridian? ?zone? or hhmm ?meridian? ?zone?. If no meridian is specified, hh is interpreted on a 24-hour clock. date A specific month and day with optional year. The acceptable formats are mm/dd?/yy?, monthname dd ?, yy?, dd monthname ?yy?, day, dd monthname yy, ?CC?yymmdd, ?CC?yy-mm-dd, dd-monthname-?CC?yy. The default year is the current year. If the year is less than 100, we treat the years 00-68 as 2000-2068 and the years 69-99 as 1969-1999. Not all platforms can represent the | years 38-70, so an error may result if these years are used. ISO 8601 point-in-time An ISO 8601 point-in-time specification, such as CCyymmddThhmmss, where T is the literal T, CCyymmdd hhmmss, or CCyymmd- dThh:mm:ss. relative time A specification relative to the current time. The format is number unit acceptable units are year, fortnight, month, week, day, hour, minute (or min), and second (or sec). The unit can be specified as a singular or plural, as in 3 weeks. These modifiers may also be specified: tomorrow, yesterday, today, now, last, this, next, ago. The actual date is calculated according to the following steps. First, any absolute date and/or time is processed and converted. Using that time as the base, day-of-week specifications are added. Next, relative specifications are used. If a date or day is specified, and no absolute or relative time is given, midnight is used. Finally, a correction is applied so that the correct hour of the day is produced after allowing for daylight savings time differences and the correct date is given when going from the end of a long month to a short month. Daylight savings time correction is applied only when the relative time is specified in units of days or more, ie, days, weeks, fortnights, months or years. This means that when crossing the daylight savings time boundary, different results will be given for clock scan "1 day" and clock scan "24 hours": % clock scan "1 day" -base [clock scan 1999-10-31] 941443200 % clock scan "24 hours" -base [clock scan 1999-10-31] 941439600 clock seconds Return the current date and time as a system-dependent integer value. The unit of the value is seconds, allowing it to be used for relative time calculations. The value is usually defined as total elapsed time from an ``epoch''. You shouldn't assume the value of the epoch. KEYWORDS
clock, date, time Tcl 8.3 clock(n)
All times are GMT -4. The time now is 01:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy