Sponsored Content
Top Forums Shell Programming and Scripting How to do simple date (time) calculation in shell script? Post 302854063 by Corona688 on Monday 16th of September 2013 05:10:05 PM
Old 09-16-2013
Most shells have a SECONDS special variable you can use.

Code:
echo "Seconds since start of script:  $SECONDS"
sleep 10
echo "Seconds since start of script:  $SECONDS"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script execution time calculation

I am writting a script in the ksh shell and am trying to find a way to report the total execution time of the script without requiring the user to specify the time function when executing the script. Does anyone have any examples they have used. I have been setting up two date variables (one at... (9 Replies)
Discussion started by: johnsonbryce
9 Replies

2. Shell Programming and Scripting

Execute a part of shell script only after particular date and time

I have created a simple shell script... say test.sh Contents of test.sh ================ service named restart cp /etc/imp.conf /backup/test/ #-- if date > 15 July 2007 11:23 pm , then only issue the commans below, else exit --- cp /etc/secondimp.conf /backup/test/ rm -f... (2 Replies)
Discussion started by: fed.linuxgossip
2 Replies

3. Shell Programming and Scripting

Is it possible to get the date and time of mail which we get into our inbox using shell script?

Hello All, I need a script which extarct the date and time of the mail which is there in our inbox... I can export the mail copy into desktop making it as a textfile or something like that.. So is there anyway to get the date and time from that? (3 Replies)
Discussion started by: smarty86
3 Replies

4. Shell Programming and Scripting

Date time calculation

hello guys, I had been to many forums and many topics in this site as well for my question but did not get any solution. My question is how i can get y'day date with time stamp today is 20100729103819 and i am looking for output as 20100728103819. in simple words as we do in oracle sysdate-1... (4 Replies)
Discussion started by: lokaish23
4 Replies

5. Shell Programming and Scripting

Date calculation script

hello! I need a date calculation script that need to do that: ./date.sh 20090312 and the script need to give me which day is it for example monday friday or what else! can anyone help me?? its really urgent :S thx the help! (7 Replies)
Discussion started by: impish
7 Replies

6. Shell Programming and Scripting

time calculation in ksh script

I"m trying to calculate the duration of of backup within a ksh shell script but I get an error. #!/bin/ksh STTIM=`date '+%T'` EDTIM=`date '+%T'` .... .... echo "DURATION OF BACKUP: $((EDTIM - STTIM))" (5 Replies)
Discussion started by: Bperl1967
5 Replies

7. Shell Programming and Scripting

Date and Time comparison using shell script

Hi, I'm having two fields in the file F1|F2 20111220|102000 F1 ->YYYYMMDD F2 ->HHMMSS Now, I need to compare this with current date & time and need to return the difference value in hours. Already, I checked with datecalc from the forum. So, need hints from Shell Gurus. Thanks (10 Replies)
Discussion started by: buzzusa
10 Replies

8. Shell Programming and Scripting

Date / Time difference in shell script

================================================================================ Request ID GMDCOM TIME GMDRRS TIME COM-RRS ================================================================================ <36812974> Tue Oct 1 13:32:40 2013 Tue Oct 1 20:36:42 2013... (1 Reply)
Discussion started by: ghosh_tanmoy
1 Replies

9. Shell Programming and Scripting

Date / Time difference in shell script

Request ID GMDCOMTM GMDRRSTIME GMDRESTIME <36812986> : : :I want to display the date -time difference in other fields. Above I have given for only 1 record. I want to calculate for all the records. (GMCOMTM - GMDRRSTM) ,(GMDRRSTM-GMDRESTM) and... (5 Replies)
Discussion started by: ghosh_tanmoy
5 Replies

10. Shell Programming and Scripting

Date time difference in UNIX shell script

There are 2 dates, Tue Oct 1 13:40:19 2013 Sun Sept 30 10:26:23 2013 I have multiple dates like the above one. How do I calculate the date time difference and display in another column in Shell script. Please help. (3 Replies)
Discussion started by: tanmoysays
3 Replies
UDHCPD.CONF(5)						 GNU/Linux Administrator's Manual					    UDHCPD.CONF(5)

NAME
udhcpd.conf - udhcp server configuration file DESCRIPTION
The file /etc/udhcpd.conf contains configuration information specific to the udhcp server. It should contain one configuration keyword per line, followed by appropriate configuration information. OPTIONS
start ADDRESS The starting address of the IP lease block is ADDRESS. The default is 192.168.0.20. end ADDRESS The ending address of the IP lease block is ADDRESS. The default is 192.168.0.254. interface INTERFACE The udhcp server should listen on INTERFACE. The default is eth0. max_leases LEASES Offer at most LEASES leases (including those reserved by OFFERs, DECLINEs, and ARP conflicts). The default is 254. remaining REMAINING If REMAINING is yes, store the time remaining for each lease. If it is no, store the expiration time for each lease. The default is yes. auto_time SECONDS Write the lease information to a file every SECONDS seconds. The default is 7200. decline_time SECONDS Reserve an IP for SECONDS seconds if a DHCP decline message is received. The default is 3600. conflict_time SECONDS Reserve an IP for SECONDS seconds if an ARP conflict occurs. The default is 3600. offer_time SECONDS Reserve an IP for SECONDS seconds if it is offered. The default is 60. min_lease SECONDS Reserve an IP for the full lease time if the lease to be given is less than SECONDS seconds. The default is 60. lease_file FILE Write the lease information to FILE. The default is /var/lib/misc/udhcpd.leases. pidfile FILE Write the process ID to FILE. The default is /var/run/udhcpd.pid. notify_file FILE Execute FILE after the lease information is written. By default, no file is executed. siaddr ADDRESS BOOTP specific option. The default is 0.0.0.0. sname NAME BOOTP specific option. There is no default. boot_file FILE BOOTP specific option. There is no default. option OPTION DHCP specific option. subnet ADDRESS timezone OFFSET router ADDRESS... timesvr ADDRESS... namesvr ADDRESS... dns ADDRESS... logsvr ADDRESS... cookiesvr ADDRESS... lprsvr ADDRESS... hostname HOSTNAME bootsize SIZE domain DOMAIN swapsvr ADDRESS rootpath PATH ipttl TTL mtu MTU broadcast ADDRESS ntpsrv ADDRESS... wins ADDRESS... requestip ADDRESS lease SECONDS dhcptype TYPE serverid ADDRESS tftp FILE bootfile FILE The default for lease is 864000. There are no defaults for the other options. SEE ALSO
udhcpd(8). GNU
/Linux 2001-09-26 UDHCPD.CONF(5)
All times are GMT -4. The time now is 08:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy