#!/usr/bin/perl use warnings; use strict; my $cmd='nohup expect -f /root/nfs_share/SCRIPTS/ncp_run.tcl &'; my $tmp= `ps -ef | grep -v grep | grep ncp_run.tcl | wc -l`; if($tmp == 1) { print"already running\n"; } else { print"not running\n"; system $cmd; }