Author Topic: How to kill some runnin perl script from bash script?  (Read 1054 times)

0 Members and 1 Guest are viewing this topic.

Offline postcd

  • Jr. Member
  • **
  • Posts: 37
  • Karma: 0
  • Gender: Male
  • just curious
    • View Profile
    • Awards
How to kill some runnin perl script from bash script?
« on: April 23, 2014, 11:38:15 am »
aim is to kill this script after 120 seconds of running and saving its output to a file. but my command not working and appears not killing the process.

Code: [Select]
#!/bin/sh
set -ex

while read domain;do
output=$(/root/tra*/script.pl $domain & pid=$!
sleep 120
pkill -f $domain)
echo "something"
echo "$output" > $domain_outputfile.txt
cat $domain_outputfile.txt
done < domains.txt

any idea why the command is not killed?
no general writing in my threads please, only helpfull ontopic please

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal