Sponsored Content
Top Forums Shell Programming and Scripting Error in script to automate the daily monitoring process of UNIX server and it's proc Post 302308926 by rdhaprakasam on Monday 20th of April 2009 03:52:45 PM
Old 04-20-2009
thanks guru the problem was resolved .
but i got syntax error at error while executing . please help me friends,
1 #!/bin/ksh
2 ##
3 ##### To find no of files in the directory
4
5
6 NOF=`ls -l /root/COMM/LOGS/eds/20081025| wc -l`
7 if [ $NOF -ne 0 ]
8 then
9 NOF=`expr $NOF - 1`
10 fi
11
12 OUTFILE="/root/temp/checking/outputfile"
13 #OUTFILE= /root/temp/checking/outputfile
14 FILE=`cat /root/temp/checking/address.txt | wc -l`
15
16 echo " /root/COMM/LOGS/eds/20081025 no of files is ${NOF} " > $OUTFILE
17
18
19 if [ $NOF -ne 0 ]
20 then
21
22 for i in $FILE;
23 do
24 TO=`head -$i /root/temp/checking/address.txt | tail -1`
25
26 MFILE=/root/temp/checking/mailfile
27
28 echo "From: "Gnanaprakasam" <gnanaprakasam@yahoo.com>" > $MFILE
29 echo "To: ${TO}" >> $MFILE
30 echo "Date: `date`" >> $MFILE
31 echo "Subject: due to the script execution problem " >> $MFILE
32 echo "\n\n" >> $MFILE
33 echo "Dear Sir/Madam," >> $MFILE
34 echo "\n\t Due to the script execution problem the following file are created" >> $MFILE
35 echo "\n\n `ls -lt /root/COMM/LOGS/eds/20081025 | tr -s " " | cut -f6,7,8,9 -d " " `" >> $MFILE
36 echo "\n" >> $MFILE
37
38 ##/bin/cat $MFILE | /usr/sbin/sendmail -fgnanaprakasam@yahoo.com $TO
39 sleep 2
40 done
41
42 fi
43
44
45
46
47
48 NOF1=`ls -l /root/COMM/LOGS/eds/20081215 | wc -l`
49 if [ $NOF1 -ne 0 ]
50 then
51 NOF1=`expr $NOF1 - 1`
52 fi
53
54 echo text >> $OUTFILE
55 DIRFILE=/root/COMM/LOGS/eds/20081215
56 echo "/root/COMM/LOGS/eds/20081215 no of files is ${NOF1} " >> $OUTFILE
57 if [ $NOF1 -ne 0 ]
58 then
59 for j in $DIRFILE;
60 do
61 temp=`ls -lt /root/COMM/LOGS/eds/20081215 | tr -s " " | cut -f6,7,8,9 -d " " `"
62 echo "test j prakash" $j
63 echo "test temp prakash" $temp
64 echo "test DIRFILE" $DIRFILE
65 done
66 for i in $FILE;
67 do
68 echo test start
69 echo "test i prakash"$i
70 echo test stop
71 TO=`head -$i /root/temp/checking/address.txt | tail -1`
72
73 MFILE="/root/temp/checking/mailfile"
74 TEST=`ls -lt /root/COMM/LOGS/eds/20081215`
75
76 echo "From: "Gnanaprakasam" <gnanaprakasam@yahoo.com>" > $MFILE
77 echo "To: ${TO}" >> $MFILE
78 echo "From: "Gnanaprakasam" <gnanaprakasam@yahoo.com>" > $MFILE
79 echo "To: ${TO}" >> $MFILE
80 echo "Date: `date`" >> $MFILE
81 echo "Subject: due to the script execution problem " >> $MFILE
82 echo "\n\n" >> $MFILE
83 echo "Dear Sir/Madam," >> $MFILE
84 echo "\n\t Due to the script execution problem the following file are created" >> $MFILE
85 echo "\n\n `ls -lt /root/COMM/LOGS/eds/20081215 | tr -s " " | cut -f6,7,8,9 -d " " `" >> $MFILE
86 echo "\n" >> $MFILE
87
88 #/bin/cat $MFILE | /usr/sbin/sendmail -fgnanaprakasam@yahoo.com $TO
89 sleep 2
90 done
91 fi




+ 1>> /root/temp/checking/outputfile
monitortest1.sh[56]: syntax error at line 86 : `"' unmatched

i have checked .there is no white space

Am using HP-UX and ksh shell
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automate daily FTP files

How to automate FTP files daily with the following constraints 1) Try (every 15 mins or 30 mins) FTP till it reconnects 2) Files that arrive in between 5:30 pm and 2:00 am 3) The sat and sun, mon files are to be FTP on monday. 4) Only the txt files are to be FTP'ed. The following are the... (2 Replies)
Discussion started by: bobbygsk
2 Replies

2. Shell Programming and Scripting

Automate Log Monitoring Process

I am a new member of this forum and am also new to unix shell scripting. I joined the forum to seek for help to achieve my task as this forum helps people. here's what i do manually on daily basis 1)Loginto different unix box 2)Ftp the log files (morethan 50 each dir) to windows 3)use text pad... (3 Replies)
Discussion started by: sharugan
3 Replies

3. Shell Programming and Scripting

automating daily monitoring process

Hi there, I have to automate daily monitoring process and then the result of these process should be sent to a log file, then this log file should be mailed . ps -ef | grep aa In this atleast one process should run. If the process is running it should mention Success in the log file... (3 Replies)
Discussion started by: NehaKrish
3 Replies

4. Shell Programming and Scripting

Bash script to Automate the Virtual Host creation process!!

Hi all, This is my sample code in /etc/httpd/conf.d/applications.conf file currently we are creating subdomain mannually for every new subdomain. I want to automate this process througs bash script , how its possible. <VirtualHost *:80> ServerName google.com ServerAlias google.com... (5 Replies)
Discussion started by: anishkumarv
5 Replies

5. Shell Programming and Scripting

Need help in creating a shell script to automate svnstats process

Hi, I am trying to create a shell script to automate the following process of getting svn stats:- Step1:- cd to checkout location. Note that the checked code have multiple modules in respective folders Step2:- Execute this command inside each module:- svn log -v --xml >... (0 Replies)
Discussion started by: d8011
0 Replies

6. UNIX for Dummies Questions & Answers

Automate sftp process using script

Hi, guys, I am trying to automate a sftp process using "expect" method (since the key authentication method is disabled in my company network, there is no helping it). In order to try, I type in the command manually: sftp @ > << EOF >cd >ls -l >EOF >Connecting to @servername password: ... (3 Replies)
Discussion started by: warmboy610
3 Replies

7. Shell Programming and Scripting

Help me with daily monitoring script

find /usr/IBM/FileNet/BulkUploaderScript/$i/Log/SuccessLog \( -newer range_start -a \! -newer range_end \) -exec wc -l {} \; |awk '{total+=$1-1} END {print total}' >>$LOGFILE I need to print time stamp of the files int the paticular period .Please modify the above script so that i get... (34 Replies)
Discussion started by: RaghavendraT
34 Replies

8. Emergency UNIX and Linux Support

Monitoring progress of a process in Linux server

Hi friends, I am quite used to using glance in HPUX servers for analysis performance issues with a particular process as requested by app. folks. The options which are very helpful to me are the "F" , "W" , "L" stats. How can i get the similar details on Linux servers without using glance?... (2 Replies)
Discussion started by: kunwar
2 Replies

9. Shell Programming and Scripting

Script to automate recovery process

Hello All! First post... I am working on a script that is used to recover a crashed drive from an rsync backup. I'm down to the place where I need to create all of the directories in /mnt where I will then mount each of the volumes and begin the restore process to each volume... I have... (3 Replies)
Discussion started by: RogerBaran
3 Replies

10. Open Source

Help with writing Shell Script to automate process using multiple commands

Hello! Need help to write a Linux script that can be run from windows using command/Cygwin/any other way. I am new to scripting, actually i am trying to automate server health check like free disk space, memory along with few services status, if any services is not running then start services ,... (7 Replies)
Discussion started by: Sayed Ibrahim
7 Replies
PERIODIC.CONF(5)					      BSD File Formats Manual						  PERIODIC.CONF(5)

NAME
periodic.conf -- periodic job configuration information DESCRIPTION
The file periodic.conf contains a description of how daily, weekly and monthly system maintenance jobs should run. It resides in the /etc/defaults directory and parts may be overridden by a file of the same name in /etc, which itself may be overridden by the /etc/periodic.conf.local file. The periodic.conf file is actually sourced as a shell script from each of the periodic scripts and is intended to simply provide default con- figuration variables. The following variables are used by periodic(8) itself: local_periodic (str) List of directories to search for periodic scripts. This list is always prefixed with /etc/periodic, and is only used when an argument to periodic(8) is not an absolute directory name. <dir>_output (path or list) What to do with the output of the scripts executed from the directory dir. If this variable is set to an absolute path name, output is logged to that file, otherwise it is taken as one or more space separated email addresses and mailed to those users. If this variable is not set or is empty, output is sent to standard output. For an unattended machine, suitable values for daily_output, weekly_output, and monthly_output might be ``/var/log/daily.log'', ``/var/log/weekly.log'', and ``/var/log/monthly.log'' respectively, as newsyslog(8) will rotate these files (if they exists) at the appropriate times. <dir>_show_success <dir>_show_info <dir>_show_badconfig (bool) These variables control whether periodic(8) will mask the output of the executed scripts based on their return code (where dir is the base directory name in which each script resides). If the return code of a script is '0' and <dir>_show_success is set to ``NO'', periodic(8) will mask the script's output. If the return code of a script is '1' and <dir>_show_info is set to ``NO'', periodic(8) will mask the script's output. If the return code of a script is '2' and <dir>_show_badconfig is set to ``NO'', periodic(8) will mask the script's output. If these variables are set to neither ``YES'' nor ``NO'', they default to ``YES'', ``YES'' and ``NO'' respectively. Refer to the periodic(8) manual page for how script return codes are interpreted. The following variables are used by the standard scripts that reside in /etc/periodic/daily: daily_clean_tmps_enable (bool) Set to ``YES'' if you want to clear temporary directories daily. daily_clean_tmps_dirs (str) Set to the list of directories to clear if daily_clean_tmps_enable is set to ``YES''. daily_clean_tmps_days (num) When daily_clean_tmps_enable is set, this must also be set to the number of days old that a file's access and modification times must be before it is deleted. daily_clean_tmps_ignore (str) Set to the list of files that should not be deleted when daily_clean_tmps_enable is set to ``YES''. Wild card characters are permitted. daily_clean_tmps_verbose (bool) Set to ``YES'' if you want the removed files to be reported in your daily output. daily_clean_msgs_enable (bool) Set to ``YES'' if you wish old system messages to be purged. daily_clean_msgs_days (num) Set to the number of days that files must not have been modified before they are deleted. If this variable is left blank, the msgs(1) default is used. daily_clean_rwho_enable (bool) Set to ``YES'' if you wish old files in /var/who to be purged. daily_clean_rwho_days (num) Set to the number of days that files must not have been modified before they are deleted. daily_clean_rwho_verbose (bool) Set to ``YES'' if you want the removed files to be reported in your daily output. daily_accounting_enable (bool) Set to ``YES'' if you want to rotate your daily accounting files. No rotations are necessary unless accounting_enable is enabled in rc.conf(5). daily_accounting_compress (bool) Set to ``YES'' if you want your daily accounting files to be compressed using gzip(1). daily_accounting_save (num) When daily_accounting_enable is set, this may also be set to the number of daily accounting files that are to be saved. The default is ``3''. daily_accounting_flags (str) Set to the arguments to pass to the sa(8) utility (in addition to -s) when daily_accounting_enable is set to ``YES''. The default is -q. daily_status_disks_enable (bool) Set to ``YES'' if you want to run df(1) (with the arguments supplied in daily_status_disks_df_flags). daily_status_disks_df_flags (str) Set to the arguments for the df(1) utility when daily_status_disks_enable is set to ``YES''. daily_status_network_enable (bool) Set to ``YES'' if you want to run netstat -i. daily_status_network_usedns (bool) Set to ``YES'' if you want to run netstat(1) without the -n option (to do DNS lookups). daily_status_rwho_enable (bool) Set to ``YES'' if you want to run uptime(1) (or ruptime(1) if rwhod_enable is set to ``YES'' in /etc/rc.conf). daily_status_mailq_enable (bool) Set to ``YES'' if you want to run mailq(1). daily_status_mailq_shorten (bool) Set to ``YES'' if you want to shorten the mailq(1) output when daily_status_mailq_enable is set to ``YES''. daily_status_include_submit_mailq (bool) Set to ``YES'' if you also want to run mailq(1) on the submit mail queue when daily_status_mailq_enable is set to ``YES''. This may not work with MTAs other than sendmail(8). daily_local (str) Set to a list of extra scripts that should be run after all other daily scripts. All scripts must be absolute path names. The following variables are used by the standard scripts that reside in /etc/periodic/weekly: weekly_whatis_enable (bool) Set to ``YES'' if you want to run /usr/libexec/makewhatis.local. This script regenerates the database used by the apropos(1) command. weekly_local (str) Set to a list of extra scripts that should be run after all other weekly scripts. All scripts must be absolute path names. The following variables are used by the standard scripts that reside in /etc/periodic/monthly: monthly_accounting_enable (bool) Set to ``YES'' if you want to do login accounting using the ac(8) command. monthly_local (str) Set to a list of extra scripts that should be run after all other monthly scripts. All scripts must be absolute path names. FILES
/etc/defaults/periodic.conf The default configuration file. This file contains all default variables and values. /etc/periodic.conf The usual system specific variable override file. /etc/periodic.conf.local An additional override file, useful when /etc/periodic.conf is shared or distributed. SEE ALSO
apropos(1), calendar(1), df(1), diff(1), gzip(1), man(1), msgs(1), netstat(1), nice(1), ac(8), newsyslog(8), periodic(8), sendmail(8) HISTORY
The periodic.conf file appeared in FreeBSD 4.1. AUTHORS
Brian Somers <brian@Awfulhak.org> BSD
May 12, 2007 BSD
All times are GMT -4. The time now is 06:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy