Linux - scripts not working in cron

Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Linux - scripts not working in cron
# 1  
Question Linux - scripts not working in cron

hi all, i have scripts executable in manully, but not working in cron. any ideas? thanks a lot?

* * * * * /home/dir/dir/file.sh

#! /bin/sh
alarmPath="/home/dir/monitoringAlarm"
alarmDateTime="$(date +%Y%m%d) $(date +%H%M%S)"

tomcatPID=`pidof /usr/local/jdk1.6.0_13/bin/java`
echo "tomcat PID = $tomcatPID"
if [ ${#tomcatPID} -gt 1 ]; then
if [ -f tomcat.txt ]; then
echo "Tomcat start"
echo "Tomcat;$alarmDateTime;4;1.0.0.0;0;2;45;; TOMCAT START;;;;;" >> $alarmPath/Tomcat_$(date +%Y%m%d%H%M%S)_1.txt
rm -f tomcat.txt
fi
else
if [ -f tomcat.txt ]; then
echo "tomcat.txt found"
else
echo "Tomcat stop"
echo "" > tomcat.txt
echo "Tomcat;$alarmDateTime;4;1.0.0.0;0;2;44;; TOMCAT STOP;;;;;" >> $alarmPath/Tomcat_$(date +%Y%m%d%H%M%S)_1.txt
fi
fi
# 2  
Double post, continued here, thread closed.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #773
Difficulty: Medium
A finite-state machine (FSM) is a specialized computer developed by AT&T.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scripts imported from UNIX to Linux are not working

Hi, Recently we migrated our app from Unix to Linux platform. All our shell scripts which use to work in Unix platform are not working in Linux now. below is such sample script. I tried removing trailing spaces, but no luck. dear experts kindly help.. #############BEGIN############### split... (7 Replies)
Discussion started by: laxman_bly
7 Replies

2. AIX

Cron scripts security

Hello everyone, I have an AIX 6.1 machine and i experienced a problem with my cron scripts. It appears that somebody renamed a cron script so crontab could not execute it. Is there a way to put some security on cron scripts so nobody else except root can rename or delete a cron script? Or they... (6 Replies)
Discussion started by: omonoiatis9
6 Replies

3. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

4. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

5. Shell Programming and Scripting

cron job is not working for two scripts

Hi Gurus, I have a test unix server in which currently some unix cronjob are running. I have written two script one is a shell script in which env variable are there (in that i am exporting those variables). I have also written a perl script . when i am running at the shell manually like... (5 Replies)
Discussion started by: sanjay.login
5 Replies

6. Shell Programming and Scripting

Linux - scripts not working in cron

hi all, i have scripts executable in manully, but not working in cron. any ideas? thanks a lot? * * * * * /home/dir/dir/file.sh #! /bin/sh alarmPath="/home/dir/monitoringAlarm" alarmDateTime="$(date +%Y%m%d) $(date +%H%M%S)" tomcatPID=`pidof /usr/local/jdk1.6.0_13/bin/java` echo "tomcat... (3 Replies)
Discussion started by: maxlee24
3 Replies

7. Shell Programming and Scripting

Running 2 scripts one after the other using cron

I would like to run two scripts using cron one immediately after the other. Is it enough to put them one after another in the cron file to run at the same time, or will this cause them to run concurrently? (4 Replies)
Discussion started by: 3210
4 Replies

8. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

9. UNIX for Dummies Questions & Answers

rsync not working thro' cron -RH Linux

Hi, I am able to use rsync and run it thro' command line. But when I schedule a script file that has rsync command thro' cron, the job doesn't get executed. All other jobs in the cron runs fine. cron entry-- 57 13 * * * /home/apm/cron/rsync-backup.sh rsync-backup.sh file-- rsync -avz... (1 Reply)
Discussion started by: sm23328
1 Replies

10. Shell Programming and Scripting

help in cron scripts

Hi, i have scheduled my scripts in cron, some time the script doesn't runs ..which will impact me a lot, can some one help me such that mail has to come stating script has run successfully/unsuccessful any help will be appreciated.. thanks in advance, geeko (0 Replies)
Discussion started by: geeko
0 Replies

Featured Tech Videos