06-28-2005
I thought I read that cron needs to be able to see the path to the script or parameteres within the script. Is this set in /etc/default/cron.
Below is a copy of the script, (message_log.pl).
# more message_log.pl
#!/usr/local/bin/perl
#! /usr/bin/ksh
#MagicStore message log utility
( $sec, $min, $hour, $mday, $mon, $year,, ) = localtime();
$today = sprintf( "%04d%02d%02d", ( $year + 1900 ), ( $mon + 1 ), $mday );
print "Parsing through message log...........\n";
sleep 2;
system("mkdir log") if (! -d "./log");
InstallScript();
system("./dl.csh > /images_1/messages/dl.out");
system("./dl.awk /images_1/messages/dl.out > /images_1/messages/dl1.out");
#---------------Set the line below to what type of message you want to trap-----
---------
system("grep PAT_INCONSISTENT /images_1/messages/dl1.out>$today.message.log");
system("rm -f /images_1/messages/dl.out");
system("rm -f /images_1/messages/dl1.out");
print "Your file named $today.message.log is ready for viewing\n";
sub InstallScript
{
unlink("/images_1/messages/dl.csh");
open(CSH,">/images_1/messages/dl.csh");
print CSH "#!/bin/csh\n";
print CSH "source ~work/.cshrc\n";
print CSH "source /home/sn_root/bin/apc/apc_env.csh\n";
print CSH "/home/sn_root/bin/apc/apc << EOF\n";
print CSH "4\n11\n5\n1\nEOF\n";
close(CSH);
system("chmod a+rwx /images_1/messages/dl.csh");
unlink("/images_1/messages/dl.awk");
open(AWK,">/images_1/messages/dl.awk");
print AWK "#!/usr/bin/nawk -f\n";
print AWK 'BEGIN { FS="\n";';
print AWK 'RS = "" }';
print AWK "\n";
print AWK "{\n";
print AWK 'if(sub(/^ date *:/,"",$1)) {';
print AWK "\n";
print AWK 'sub(/^ message *:/,"",$2)';
print AWK "\n";
print AWK 'print $1,$2';
print AWK "\n";
print AWK "\n}\n}";
close(AWK);
system("chmod a+rwx /images_1/messages/dl.awk");
}
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I've got an *extremely* simple script I want to run every minute:
#!/bin/sh
ping -c 1 192.168.1.20 > ~/onlinestatus.txt
So, the script is called "status", it's executable, and in the correct path, etc. In a terminal window (I'm using Mac OS X), I can type status, and it will create... (4 Replies)
Discussion started by: jmf77
4 Replies
2. Shell Programming and Scripting
Hi all,
Does anybody know or guide me on how to remove the first N bytes and the last N bytes from a binary file? Is there any AWK or SED or any command that I can use to achieve this?
Your help is greatly appreciated!!
Best Regards,
Naveen. (1 Reply)
Discussion started by: naveendronavall
1 Replies
3. UNIX for Dummies Questions & Answers
I am attempting to run a cron job, however, I receive this cron output error:
Error: of parameter : xxxxx does not make a valid output file.
What causes this? (4 Replies)
Discussion started by: AM1234
4 Replies
4. Solaris
root@erpdevserver $ vxassist -g devdg maxsize
Maximum volume size: 55207936 (26957Mb)
This is the output in vxvm(3.1).. my question is
how we can calculate this bytes(55207936) in to MB(output=26957) or in GB.plz tell how to calculate (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies
5. Red Hat
I have the following cron task set to run every 15 minutes to ascertain how many users are in the system and append the result to the log.
/home/pronto/cus/whoisinc >> /home/pronto/cus/whoisin.log
This is the whoisinc script
date +"%d-%m-%Y,%k:%M,Pronto Users,`prowho -s | grep -v... (1 Reply)
Discussion started by: scottm
1 Replies
6. Shell Programming and Scripting
While running script I am getting an error like
Few lines in data are not being processed.
After googling it I came to know that adding such line would give some memory to it
ini_set("memory_limit","64M");
my input file size is 1 GB.
Is that memory limit is based on RAM we have on... (1 Reply)
Discussion started by: elamurugu
1 Replies
7. Programming
Hi,
If I want to copy a 1024 byte data stream in to the target location in 3-bytes chunk, I guess I can use the following script.
dd bs=1024 count=3 if=/src of=/dest
But, I would like to know, how to do it via a C program. I have tried this with memcpy(), that did not help. (3 Replies)
Discussion started by: royalibrahim
3 Replies
8. Shell Programming and Scripting
How do I output only the first 400 bytes of a huge text file to a new file.
It has to be unmodified so no added invisible characters.
Many thanks..... (3 Replies)
Discussion started by: garethsays
3 Replies
9. UNIX for Dummies Questions & Answers
Hello guys. I really hope someone will help me with this one..
So, I have to write this script who:
- creates a file home/student/vmdisk of 10 mb
- formats that file to ext3
- mounts that partition to /mnt/partition
- creates a file /mnt/partition/data. In this file, there will... (1 Reply)
Discussion started by: razolo13
1 Replies
10. Shell Programming and Scripting
hello,
suppose, entered input is of 1-40 bytes, i need it to be converted to 40 bytes exactly.
example: if i have entered my name anywhere between 1-40 i want it to be stored with 40 bytes exactly.
enter your name:
donald duck (this is of 11 bytes)
expected is as below - display 11... (3 Replies)
Discussion started by: shravan.300
3 Replies
LEARN ABOUT OPENSOLARIS
igawk
IGAWK(1) Utility Commands IGAWK(1)
NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO
gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWgawk |
+--------------------+-----------------+
|Interface Stability | Volatile |
+--------------------+-----------------+
NOTES
Source for gawk is available on http://opensolaris.org.
Free Software Foundation Nov 3 1999 IGAWK(1)