Re: Using PHP for server utilities

From: Date: Thu, 25 Oct 2001 16:59:01 +0000
Subject: Re: Using PHP for server utilities
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-72309@lists.php.net to get a copy of this message
Scott, This seems a pretty elementary task, ATC, though the detection of when the transfers are done is problematic. You could use the filesystem functions, particularly stat(), for assistance. I run php code as regular programs, not for web-based access, pretty regularly. You simply use the shebang on the first line of your file, as in Perl, etc. #!/usr/local/bin/php <? echo "hi, i'm a php program!\n"; echo "woohoo!!\n"; if (file_exists("public_html")) : print "you've got a web directory here\n"; else : print "no public_html, so sad...\n"; $mk_result = mkdir("public_html", 0755); if ($mk_result) : print "i made one for you!\n"; else : print "i tried, but failed :-(\n"; endif; endif; ?> "The rest is left as an exercise for the reader" Cheers, Chuck At 7:32 AM -0700 10/25/01, Scott wrote: >Hello- > >I am dreading having to break out my perl books, so here is a thought >about using PHP on the server to handle a chore for me. > >I have a Linux ftp server that accepts files from a mainframe every >night. I need to take those files, determine when the transfer is >done and then re-send them to another machine across a wan. When that >transfer is complete I need to make a new directory (date would be ok) >and move all of the files into that directory, tar them and finally >produce a status page. > >Thoughts? Has anyone tried this with php? BTW--it has to be automatic >as a cron job. > >Thanks in advance. > >-Scott > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net Chuck Theobald, Technology Manager ERIC Clearinghouse on Educational Management 5207 University of Oregon, Eugene, OR, 97403-5207 800-438-8841 * 541-346-1662 (voice) * 541-346-2334 (fax) * 541-337-0182 (cell) * * http://eric.uoregon.edu/ * mailto:ctheobald@eric.uoregon.edu *

« previous php.general (#72309) next »