Hi,
I'm unable to understand why the grep command in cronjob works intermittently
Expected output:
Grep command to look for a particular string with today's date and exit from infinite while loop else it must sleep for 5 mins
I'm using the following statement in my shell script, the variable $logString is empty even when the pattern exists in the log
while it was successful in yesterday's cron run
Sleep for 5 mins
String is: STATUS [06/09 05:04:57]: main: Active region has been changed from: 0 to: 1
it failed today
Sleep for 5 mins
String is:
Moderator's Comments:
Please use code tags
Last edited by jim mcnamara; 06-10-2019 at 08:40 AM..
Hi,
Here is the code snippet when executing on the command line it does execute smoothly, but while i place this on cron it doesnt run.
Can anybody suggest where the problem in cron is.?
#!/usr/bin/ksh
home_dir="/export/home/scripts/MonitorScripts"
ThresholdLimit=5
touch... (6 Replies)
Hi,
I want to run a crontab job on solaris 10.5. I have configured the crontab accordingly
10 * * * * /scripts/dbalter.pl >> /scripts/cronout.txt
However this does not work .Then I go to /var/mail/root and find an error in the output:
From root@myserver Wed Feb 4 17:02:00 2009... (1 Reply)
Guys,
I am beginer in unix. There is a cobol file with fixed-width. I want to read the total Line, Word and character count. I have tried with wc-l unix command, but it returns '0'.
Please advice me the correct command/steps to get the record count.
Thanks in advance. (4 Replies)
Hi,
I have written a shell script to transfer files to a SFTP server passing the filername, source and dest directory as parameters and it runs well. :)
I want to schedule this script to run periodically using a cron job.
root@pingu # cat /etc/crontab
SHELL=/bin/bash... (1 Reply)
Hi friends,
today i created a cron job , registered the crontab file associated but dont know why the cron is not getting executed at the right time.??
content of Crontab file :
21 15 * * * /subrat/myt
i wanted to execute the script myt on 15:21 PM of everyday.
the script myt... (2 Replies)
I am scheduling a task at regular intervals at seconds acuracy using crond and sleep command . my data in crontab file is as below:-
the above line is working fine when we are creating this crontab file before 00:05 min .
But when we are creating the crontab file at 00:05min , unable to... (10 Replies)
I am new to creating crontab file , i just wrote below
(40 19 * 3 * /root/maths/practisecron.sh), the script just prints "Hi".
When ever i save the above file i am getting this .
# crontab -e
crontab: installing new crontab
Can you please check where it went wrong.. (1 Reply)
Good evening, ive got this cron to be run:
if i run this manually it doesnt work,it takes me to the prompt again
/export/app/CO/opge/scr/Informe_parametros_colombia.ksh >/dev/null 2>&1
here is the code fragment:
coopge@coopge: opge PRODUCCION>more... (1 Reply)
Hello gurus,
I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired
report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup
is shown below:
#!/bin/ksh
db2... (3 Replies)
HI,
I have written an executable file in unix and I was able to execute it successfully but when I called this file with cron job it was giving error like "permission denied" and "No such file or directory".
Please help in how cron calls the file and what permission is required on the file... (2 Replies)
Discussion started by: vipin kumar rai
2 Replies
LEARN ABOUT SUNOS
fgrep
fgrep(1) User Commands fgrep(1)NAME
fgrep - search a file for a fixed-character string
SYNOPSIS
/usr/bin/fgrep [-bchilnsvx] [-e pattern_list] [-f pattern-file] [pattern] [file...]
/usr/xpg4/bin/fgrep [-bchilnsvx] [-e pattern_list] [-f pattern-file] [pattern] [file...]
DESCRIPTION
The fgrep (fast grep) utility searches files for a character string and prints all lines that contain that string. fgrep is different from
grep(1) and from egrep(1) because it searches for a string, instead of searching for a pattern that matches an expression. fgrep uses a
fast and compact algorithm.
The characters $, *, [, ^, |, (, ), and are interpreted literally by fgrep, that is, fgrep does not recognize full regular expressions as
does egrep. These characters have special meaning to the shell. Therefore, to be safe, enclose the entire string within single quotes (').
If no files are specified, fgrep assumes standard input. Normally, each line that is found is copied to the standard output. The file name
is printed before each line that is found if there is more than one input file.
OPTIONS
The following options are supported:
-b Precedes each line by the block number on which the line was found. This can be useful in locating block numbers by con-
text. The first block is 0.
-c Prints only a count of the lines that contain the pattern.
-e pattern_list Searches for a string in pattern-list. This is useful when the string begins with a -.
-f pattern-file Takes the list of patterns from pattern-file.
-h Suppresses printing of files when searching multiple files.
-i Ignores upper/lower case distinction during comparisons.
-l Prints the names of files with matching lines once, separated by new-lines. Does not repeat the names of files when the
pattern is found more than once.
-n Precedes each line by its line number in the file. The first line is 1.
-s Works silently, that is, displays nothing except error messages. This is useful for checking the error status.
-v Prints all lines except those that contain the pattern.
-x Prints only lines that are matched entirely.
OPERANDS
The following operands are supported:
file Specifies a path name of a file to be searched for the patterns. If no file operands are specified, the standard input will
be used.
/usr/bin/fgrep
pattern Specifies a pattern to be used during the search for input.
/usr/xpg4/bin/fgrep
pattern Specifies one or more patterns to be used during the search for input. This operand is treated as if it were specified as
-e pattern_list.
USAGE
See largefile(5) for the description of the behavior of fgrep when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of fgrep: LC_COLLATE, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 If any matches are found
1 If no matches are found
2 For syntax errors or inaccessible files, even if matches were found.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
/usr/bin/fgrep
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
/usr/xpg4/bin/fgrep
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWxcu4 |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
SEE ALSO ed(1), egrep(1), grep(1), sed(1), sh(1), attributes(5), environ(5), largefile(5), XPG4(5)NOTES
Ideally, there should be only one grep command, but there is not a single algorithm that spans a wide enough range of space-time tradeoffs.
Lines are limited only by the size of the available virtual memory.
/usr/xpg4/bin/fgrep
The /usr/xpg4/bin/fgrep utility is identical to /usr/xpg4/bin/grep -F (see grep(1)). Portable applications should use /usr/xpg4/bin/grep
-F.
SunOS 5.10 4 Oct 2002 fgrep(1)