Are you checking that all the files have been sent in the last hour, or just the latest file?
Solaris is rather limited in what you can do with respect to date and file timestamps but how about something like this (untested)?
Code:
DATE_DIR=$(date +%Y%m%d)
cd /data/CDR/sswitch_roa/voice/bkup/${DATE_DIR}
typeset -Z2 hour
hour=$(( $(date +%H) - 1 ))
if [[ $hour -lt 1 ]]
then exit
fi
tmpfile=$(mktemp)
touch -t $(date +"%m%d$hour%M$S") ${tmpfile}
latest_file=$(ls -t *.gz | head -1)
if /usr/xpg4/bin/test ${latest_file} -nt ${tmpfile}
then
# we have files newer than one hour
else
# nothing in the last hour
fi
rm ${tmpfile}
This requires /bin/ksh to run the code.
I have tested some of the statements standalone on a Solaris system so I am confident you can get something to work from here.
I have a set of files in a folder, I need a script which basically checks whether each file is present or not and if any one of them is missing , the script should fail (exit out) displaying the name of the file which does not exist .
this is the list of files
insert_dma_prspct_daily_tmp.sql... (3 Replies)
Hi all,
I need a script in ksh:
1: Copy files from directory (A) to directory (B)
2: Check if files that will be copied in directory (A) have never been yet copied to (B)
3: Never copy the last created file of directory (A)
This script will run on crontab.
Thanks in advance for your... (1 Reply)
I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Hi,
I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is
# echo $0
-sh
My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
hi,
I am having script in which i want to check if directory has any file in it or not. If directory contains a single or more files then and only then it should proceed to further operations...
P.S.: Directory might have thousand number of files. so there might be chance of getting error... (4 Replies)
Hi All,
I wanted to check the files ownership and permission based on the path given it as arguments thru script.
I was able to get the required command using ls but i would like this command to put in a script and check the file ownership against the what it needs to be and report back if... (12 Replies)
Hi,
I am trying to write a script for following scenario:
I have a list of countries from where I receive files...eg. (Indonesia, Thailand, Australia...etc)
For each country, I have a list of files that they send.
IND -- a,b,c
TH -- p,q,r
AU -- x,y,z
The path for these files could... (2 Replies)
I created this script for check whether specific files exist or not in the given location. but when I run this its always showing
Failed - Flag_lms_device_info_20160628.txt do not exist
Failed - Flag_lms_weekly_usage_info_20160628.txt do not exist
but both files are existing. appreciate help... (2 Replies)
Hello,
I needed help with a shell script where in it checks if a file exists under a directory and also checks the age of the file and delete it if it is older than 3 weeks.
thanks (10 Replies)
Hi
In live system core files are generating frequently. around 10 core files in 30 mins in root file system. which is eating my space very much
below is core file
core.56539
core.78886
core.12302
core.80554
core.20147
I am trying to write a script which should move... (7 Replies)
Discussion started by: scriptor
7 Replies
LEARN ABOUT DEBIAN
osd_clock
OSDClock(1) General Commands Manual OSDClock(1)NAME
osd_clock - X on-screen clock displayer
SYNOPSIS
osd_clock [OPTION]... [+FORMAT]
DESCRIPTION
Display date/time information on screen.
-f FONT
Set font.
-c COLOR
Set color.
-d DELAY
Sets the delay (in seconds) that the clock is exposed. Useful if combined with INTERVAL.
-F FORMAT
This option specifies the format to be used to output the date. See 'strftime(3)'.
-i INTERVAL
This specifies the interval between displays. Default is 1 (display every second).
-H INTEGER
The "chimes per hour" count overrides -i. Default is 0 (no effect).
The time will be displayed this many times each hour (notwithstanding signals interrupting sleep, and leap seconds). The first dis-
play of the hour will be on the hour exactly. Use -H 4 for a display at 0, 15, 30 and 45 minutes past.
-s SHADOW
This option sets the shadow depth. Default 2.
-t locate clock at top left (default: bottom left).
-b locate clock at bottom left (default).
-o OFFSET
This option specifies the offset from the top or bottom of screen the text is displayed. The default is 0. Useful to move above or
below panels or applets.
-h, --help
display this help and exit
BUGS
The per-hour mode may fire up to one second late, or worse if the system is busy.
AUTHOR
Jon Beckham <leftorium@leftorium.net>
Martijn van de Streek <martijn@foodfight.org>
Nathan Walp <faceprint@faceprint.com>
COPYRIGHT
It is distributed under the GNU General Public License.
X OSD Clock March 2001 OSDClock(1)