![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with cron job | solne | SUN Solaris | 7 | 01-18-2008 08:57 PM |
| cron problem! | blowtorch | UNIX for Advanced & Expert Users | 4 | 03-08-2006 01:12 AM |
| Problem with cron | jhansrod | AIX | 2 | 11-25-2005 04:30 PM |
| cron problem | VPN | UNIX for Dummies Questions & Answers | 2 | 04-16-2004 07:27 AM |
| Cron Problem | Raiden | Shell Programming and Scripting | 4 | 11-16-2003 07:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem with Cron tab
I have a script for pinging the switches and giving me the report:-
#!/usr/local/bin/perl #!/bin/ksh #!/usr/bin #etc `source /export/home/chinnigd/.profile`; @names = `cat switches|cut -f1 -d' '`; @ip = `cat switches|cut -f2 -d' '`; $num = @names; $re ="Empty"; $i = 0; $flag = 0; while ($i lt $num) { $ou = `ping $ip[$i]`; if ( $ou == "no answer from $ip[$i]" ) { print "ALERT!!The Switch is DOWN-->$names[$i]\n"; $flag = 1; } else { print "The Switch is up-->$names[$i]\n"; } $i = $i + 1; } if ($flag -eq 0) { print "**************************************************************\n"; print "*All the switches,totally $num Switches,in the network are UP*\n"; print "**************************************************************\n"; } This script works fine in the command line but when I put it in the crontab, the cron job run at the specified time but the script doesn't work properly i.e. some commands in the script doesn't execute correctly and I always get the output as " All the switches. totally <> switches in the network are UP". kindly help me how to solve this |
|
||||
|
hi
make sure that if u r accessing any file from particular path.. then specify complete path while accessing that file. like u r reading a content of file - as name test. and path for this file is bin/sql/proc/util/test. then use this complete path -- as crontab assument system path by default. Cheers Regards Swapneel |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|