Jump to content
php.lv forumi

popen un unlink


Recommended Posts

Man ir shaada funkcija, lai programa darbotos bacgrkounda:

 

function execInBackgroundb($cmd, $file) {
if (substr(php_uname(), 0, 7) == "Windows"){
	pclose(popen("start /B ". $cmd, "r"));
}
else {
	exec($cmd . " > /dev/null &");  
}
}

 

Tad man ir shaada rindinja, kas palaizh programu un taas darbiibu

execInBackgroundb($ffmpeg." -i ".$upload_path.$filename." -s 480x234 -vcodec mjpeg -ss 5 -an -f rawvideo -vframes 1 ".$img, "$upload_path$filename");

 

Probleema ir taada, ka man vajag unlikot $upload_path.$filename , bet kameer ffmpeg konvertee sho failu nevar un nevajag izdzeest, ir iespeejams noteikt kad beidz konvertaacija, un tad likt unlikot?

Link to post
Share on other sites
  • 1 year later...

emm, viens risinajums varetu but batch job. Batchjobam var padot arejaas references kas tava gadijumā būs $upload_path.$filename un $img, un batch jobā tad attiecīgi ieliec visu komandu ar referencēm, un aiz vinas faila dzesanu. Kad pirma komanda bus pabeigta batch izpildis nakamo.

 

no php funkcijas savukart izsauc to batch ar parametriem.

 

Sikāk skaties googlee.

Par risinajumu neesmu drosh, nekad neesu meginajis, kur nu vel linux videe :(

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...