Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^3: perl script in nohup running from crontab

by hbm (Hermit)
on Sep 22, 2011 at 14:44 UTC ( #927380=note: print w/replies, xml ) Need Help??

in reply to Re^2: perl script in nohup running from crontab
in thread perl script in nohup running from crontab

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/ >>/root/nfs_share/SCRIPT +S/temp.txt ---------------- 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; }

Replies are listed 'Best First'.
Re^4: perl script in nohup running from crontab
by tanuj (Novice) on Sep 22, 2011 at 15:49 UTC
    ya i tried with putting the patj /usr/bin/expect ..but no luck in logs everything looks fine to me:
    [root@perflnx14 SCRIPTS]# tail /var/log/cron Sep 21 23:15:01 perflnx14 crond[1932]: (root) CMD (perl /root/nfs_shar +e/SCRIPTS/ >>/root/nfs_share/SCRIPTS/temp.txt) Sep 21 23:16:01 perflnx14 crond[1947]: (root) CMD (perl /root/nfs_shar +e/SCRIPTS/ >>/root/nfs_share/SCRIPTS/temp.txt) Sep 21 23:17:01 perflnx14 crond[1972]: (root) CMD (perl /root/nfs_shar +e/SCRIPTS/ >>/root/nfs_share/SCRIPTS/temp.txt)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://927380]
[marinersk]: choroba LOL wow, y'all are on a roll today.
[Eily]: nice post count marinersk
[Eily]: I also like that this number appears right below "Priest"
[marinersk]: LOL OMG. I may have to create a new account and leave this one here.
[marinersk]: Or maybe I'll just not ever post again. That would make several Monks happy.
[hippo]: :-)

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2017-05-29 15:12 GMT
Find Nodes?
    Voting Booth?