Any errors in /var/cron/log or wherever you system keeps them? If you can't view that log, add 2>&1 (or whatever is appropriate on your system) to redirect STDERR to your own log file.
Your cron entry starts with "perl". Why, when you have #!/usr/bin/perl in your script?
I'd also add #!/path/to/expect -f to the .tcl, to simplify your $cmd.
And excessive pipe alert in your grep...
[root@perflnx14 SCRIPTS]# crontab -l
* * * * * /root/nfs_share/SCRIPTS/cron_ncp.pl >>/root/nfs_share/SCRIPT
+S/temp.txt
---------------- cron_tab.pl script:
#!/usr/bin/perl
use warnings;
use strict;
#my $cmd='nohup expect -f /root/nfs_share/SCRIPTS/ncp_run.tcl &';
my $cmd='nohup /root/nfs_share/SCRIPTS/ncp_run.tcl &';
#my $tmp= `ps -ef | grep -v grep | grep ncp_run.tcl | wc -l`;
my $tmp= `ps -ef | grep -c [n]cp_run.tcl`;
if($tmp == 1) {
print"already running\n";
} else {
print"not running\n";
system $cmd;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|