In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] (Chris Garaffa) wrote:

> Instead of doing this, I'd like to have cron run a perl script which 
> looks up iTunes' pid and then kills that pid. Here's a rough sketch of 
> what I have so far:
> 
> #!/usr/bin/perl -w
> use strict;
> $pid_num = `top | grep iTunes`;

if you want to shell out to do this, `ps` with the right flags
is easier.  however, look around to see if iTunes creates a file
with it's current PID.  i'd look for you but i don't want to reboot
into OS X ;)

if that doesn't work, you might consider a wrapper to launch iTunes
that also captures its PID and creates such a file.  i imagine that
you have something somewhere that restarts iTunes at the appropriate
time as well. :)

> $pid_num =~ s/[\d.]+/;
> open(CRONTAB, ">/var/cron/tabs/root");

there is no need to edit the crontab.  simply put this perl
script in the contab, and kill the iTunes process with Perl's
kill().

-- 
brian d foy <[EMAIL PROTECTED]> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to