Can't close the process (Perl)

xiaoxiao2021-03-05  25

I have encountered a problem today, and BitComet on the server will always be inexplicably dead, so I must find a way to let him start again.

This kind of question may be easy to solve, but like me, I can't think of a good way, I have to use a stupid approach.

Use win32 :: process; us Win32;

Sub ErrorReport {Print Win32 :: FormatMessage (Win32 :: getLastError ());}

While (1) {($ Second, $ MINUTE, $ HOUR, $ WEEKDAY, $ DayOfyear, $ ISDST) = LOCALTIME (TIME); $ YEAR = 1900; $ dt = "$ Year- $ MONTH- $ DAY $ HOUR: $ MINUTE: $ Second "; Print" Start AT $ DT ... / N "; Win32 :: Process :: Create ($ ProcessObj," g: ///bitcomet.exe " , "", 0, Normal_Priority_Class, ".") || DIE ErrorReport (); $ processobj-> suspend (); $ processobj-> resume (); $ processobj-> wait (infinite);}

EXIT;

Seeing this program, the most critical is that while (1) loop, use this loop, then cooperate with the content inside, you can let BitComet have been running, dead, just run.

Although it is very simple, because there is no experience, I don't know what the problem will have, and there is a hidden danger, so I hope everyone will communicate together.

转载请注明原文地址:https://www.9cbs.com/read-32799.html

New Post(0)