Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Error while running a script through cron job Post 302893141 by Ekamjot on Monday 17th of March 2014 03:34:01 PM
Old 03-17-2014
Please find the output
Code:
++ export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/sar
++ PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/sar
++ ADMIN=abc@abc.com
+++ /usr/bin/sar
+++ /usr/bin/awk '{print $9}'
+++ /bin/sort -n
+++ /usr/bin/head -5
+++ /bin/sed -n 5p
++ CPU_HIGH=
+++ echo 'scale=3; 100-'
+++ /usr/bin/bc
(standard_in) 2: parse error
++ CPU_MAX=
+++ /usr/bin/sar
+++ awk '{print $9}'
+++ sort -n
+++ tail -1
++ CPU_LOW=
+++ echo 'scale=3; 100-'
+++ /usr/bin/bc
(standard_in) 2: parse error
++ CPU_MIN=
+++ awk '{print $2}'
++++ date +%d-%B-%Y
+++ sort -n
+++ tail -1
+++ cat /root/admin_files/server_monitor/datewise_monitor/ram_monitor-17-March-2014
++ MEM_MAX=12.200
+++ awk '{print $2}'
++++ date +%d-%B-%Y
+++ sort -n
+++ head -1
+++ cat /root/admin_files/server_monitor/datewise_monitor/ram_monitor-17-March-2014
++ MEM_MIN=11.800
+++ date +-%Y-%m-%d-%H:%M:%S
++ now=-2014-03-17-18:20:01
++ file=utilization_-2014-03-17-18:20:01.log
++ filename=/root/admin_files/server_monitor/datewise_monitor/utilization_-2014-03-17-18:20:01.log
+++ date
+++ hostname
++ echo 'Mon Mar 17 18:20:01 GMT 2014: Memory Utilization Report for server mmv0pfecdel0070 is'
++ echo -----------------------------------
++ echo '                                   '
++ echo 'CPU Max Utilization :   %  '
++ echo 'CPU Min Utilization  :   % '
++ echo '                                   '
++ echo 'Max Ram Utilization :  12.200 %  '
++ echo 'Min Ram Utilization  :  11.800 % '
++ cat /root/admin_files/server_monitor/datewise_monitor/utilization_-2014-03-17-18:20:01.log
+++ date +%d-%B-%Y
+++ hostname
+++ ifconfig eth0
+++ sed -n '/inet /{s/.*addr://;s/ .*//;p}'
++ mail -s '17-March-2014: CPU & Memory Summarization Report for server mmv0pfecdel0070 : 10.129.192.198 ' abc@abc.com
++ sar
+++ date +-%d-%B-%Y
++ sar -r
+++ date +-%d-%B-%Y

---------- Post updated at 01:45 PM ---------- Previous update was at 01:44 PM ----------

The same code is working when running manually.

---------- Post updated at 02:34 PM ---------- Previous update was at 01:45 PM ----------

i guess there is an issue when using bc in the crontab.

Last edited by Franklin52; 03-18-2014 at 04:02 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. HP-UX

Cron Job Not Running

Hi, I have a cron schedule like this 04,16,28,40,52 * * * * /nag/startProcessABatch (unix script) i want to add new lines in this file (like Logging), i just copy this file into a /tmp folder (for backup copy), and i have edited this file (added few lines of code for logging). ... (1 Reply)
Discussion started by: nag_sundaram
1 Replies

2. UNIX for Advanced & Expert Users

cron job is not running

hi, i have the following line in the crontab 15 5 * * 6 /home/adw/BCE_ADW.pl The problem is the cron job is not getting started automatically. But this was working til last week. now it is not working. what could be the problem. Any idea? (3 Replies)
Discussion started by: Suguna
3 Replies

3. Shell Programming and Scripting

Cron job giving error while running SSH command

Hi All, The script which i am using to SSH to remote server is working fine when i run is using ./ but when cron runs it it gives error that "ssh: not found" please help!!! (3 Replies)
Discussion started by: visingha
3 Replies

4. Shell Programming and Scripting

URGENT: cron job not running the sqlplus command in shell script

cron job not running the sqlplus command in shell script but the shell script works fine from command line.. Cronjob: 5 * * * * /home/dreg/script.sh script.sh: #!/bin/ksh /oracle/u000/app/oracle/product/10204/GEN/bin/sqlplus -s <user>/<pass>@<sid/home/dreg/sqlscript.sh ... (18 Replies)
Discussion started by: Ikea
18 Replies

5. UNIX for Dummies Questions & Answers

Cron job not running

Hi All, I am editing crontab using -e option to add a new job Below is the line 30 * * * * scriptpath This job is not executing every thirty minutes. I have checked, cron daemon is running. What did I miss? Can some one help? I am using cron shell..ksh (7 Replies)
Discussion started by: yabhi_22
7 Replies

6. Shell Programming and Scripting

Running script file using cron job every 5 second

Hi All, I beginner in unix, i have no idea how to set the script file using cron job every 5 second. I also want to execute automatically the output to text file.This is my script name countsys.sh and my textfile abc.txt. (6 Replies)
Discussion started by: mastercar
6 Replies

7. Solaris

Shell Script gives error when run through cron job.

Hi, The following shell script runs without any problem when executed manulally. USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1) if then find /arch/AUBUAT/ -type f -mtime +0 | xargs rm find /arch/AUBMIG/ -type f -mtime +0 | xargs rm fi But the same gives below... (6 Replies)
Discussion started by: ksadiq79
6 Replies

8. Solaris

Cron job is not running

Hi, I have set up the crontab as follows. root@IDC4VASAPP07 # crontab -l 0-59 * * * * /var/tmp/r.sh 0-59 * * * * date >> /var/tmp/log root@IDC4VASAPP07 # r.sh is as follows. root@IDC4VASAPP07 # cat r.sh #!/bin/bash dt1=$(perl -e 'use POSIX;print strftime... (10 Replies)
Discussion started by: SunilB2011
10 Replies

9. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

10. Shell Programming and Scripting

CRON job still running?

Hi All, I am writing a script that will eventually be executed by a cron job every 15 minutes. I want to make sure that my logic/script doesn't get executed if a previous job is still running. What would be the best way to handle that scenario? I was thinking to make my script create a temporary... (1 Reply)
Discussion started by: rdogadin
1 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 06:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy