Re: sleep between system calls



Ian Wilson <scobloke2@xxxxxxxxxxxxx> wrote:
> xhoster@xxxxxxxxx wrote:
> > dwmyers@xxxxxxxxxxx wrote:
> >
> >>I have a task that runs as follows:
> >>
> >>1) examine a daemon in memory for size usage. If it gets beyond a
> >>certain size, kill it.
> >>2) wait a while
> >>3) restart the process.
> >>
> >>I'm trying with a bit of code like this:
> >>
> >>system("pkill -9 foo");
> >>sleep 10;
> >>system("/etc/init.d/foo start");
> >>
> >>Only problem is, the sleep isn't working, and the process isn't
> >>restarting.
> >
> >
> > That sounds like two different problems, and "isn't working" is the
> > worst description ever.
> >
> >
> >>I tend to think the first system call must be returning
> >>signals that kill the sleep, but I'm not deep enough into the internals
> >>to know.
> >>
> >>If you have any ideas, I'm interested.
> >
> >
> > Ask perl for help. Are you using strict and warnings?
> >
> > system("pkill -9 foo") and die "$!";
> > warn "slept for ", sleep 10;
> > system("/etc/init.d/foo start") and die "$!";
> >
>
> s/and/or/ or please_explain();
>
> Thanks.

sub please_explain {
system "perldoc -f system";
};

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages

  • Re: YAAP (NAO) Tenaya - Lawful Elf Wizard - 257 kills - No Unique kills
    ... their kill list below 200 and probably even below 100. ... help would have been writing or finding a spellbook of sleep. ... Sokoban, I found, required, for the most part, killing creatures. ... a fire giant - sleep could have saved ...
    (rec.games.roguelike.nethack)
  • Re: Attn JonA & Buddude: ASFPPE FF Forum
    ... --The Dread Pirate Roberts ... Sleep well. ... I'll most likely kill you in the morning." ... dwight wrote: ...
    (alt.sports.football.pro.phila-eagles)
  • Re: is killing zombies possible w/o a reboot?
    ... >> I'd tried to kill the zombie earlier but couldn't. ... window, but never did anything to it. ... because it keeps track of all resources in tables in the kernel ... reclaims all its memory to the system free memory ...
    (Linux-Kernel)
  • Re: [PATCH 1/2 (repost)] mm: serialize OOM kill operations
    ... The patch below modifies the behavior of the OOM killer so that only ... one OOM kill operation can be in progress at a time. ... in addition to the program that is eating lots of memory. ... would appear to be just to block all tasks as they enter the oom-killer. ...
    (Linux-Kernel)
  • Re: Attn JonA & Buddude: ASFPPE FF Forum
    ... The Dread Pirate Roberts ... Sleep well. ... I'll most likely kill you in the morning." ... And the straight female to male ratio is better nowadays. ...
    (alt.sports.football.pro.phila-eagles)