简体   繁体   English

如何编写一个批处理/ CMD文件,以每5分钟检查一次进程是否停止然后执行url?

[英]How to write a Batch/CMD file to check every 5mins if process stops then execute url?

So i use PHP to execute FFMPEG for video conversions and to save me manualy executing a URL to trigger the video conversions i figured it could be possible with a batch/cmd script. 因此,我使用PHP执行FFMPEG进行视频转换,并省去了手动执行URL触发视频转换的手动操作,我认为使用批处理/ cmd脚本是可能的。

the process in question is named ffmpeg.exe 有问题的进程名为ffmpeg.exe

And the url i need to execute is the following : website/index.php?option=com_hwdmediashare&task=maintenance.process&format=raw&token=LOL 我需要执行的网址如下: website / index.php?option = com_hwdmediashare&task = maintenance.process&format = raw&token = LOL

I need to check if ffmpeg.exe is running every 5 minutes if not then execute that url or perhaps i am thinking it may be more simple to launch that url through php.exe itself. 我需要检查ffmpeg.exe是否每5分钟运行一次,如果没有,则执行该URL,或者我认为通过php.exe本身启动该URL可能更简单。

I did it this way. 我是这样做的。

:loop
@echo off
tasklist /nh /fi "imagename eq ffmpeg.exe" | find /i "ffmpeg.exe" >nul && (
echo FFMPEG is running
) || (
echo FFMPEG is not running
C:\php\php.exe -f "C:\public_www\administrator\components\com_hwdmediashare\cli.php" process
)
timeout /t 300 /NOBREAK >NUL
goto loop
pause>nul

Hopefully nobody sees any issues with my code ? 希望没有人看到我的代码有任何问题吗? I think i may have a problem over time the memory usage of cmd.exe will be high if anyone knows how to fix that ? 我认为随着时间的流逝,如果有人知道如何解决此问题,cmd.exe的内存使用率将会很高。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM