FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Only Allow exec in CLI
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Only Allow exec in CLI [message #179214 is a reply to message #179212] Tue, 25 September 2012 11:13 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
Tim Streater wrote:
> In article <k3sciu$oup$1(at)news(dot)albasani(dot)net>,
> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>
>> Tim Streater wrote:
>>> In article <k3s5u9$9hl$1(at)news(dot)albasani(dot)net>,
>>> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>>> > Tim Streater wrote:
>>>> > > No checking of result codes required or error handling needed?
>>>> > Yes. If they fail. they fail gracefully. and they leave errors in
>>>> their logfiles.
>>>> Are they independent of each other then, such that they could be
>> run in > parallel? Or are there failure modes for program x that would
>> mean you'd > not want to run x+1 etc ??
>
>> Mutatis mutandis, the code could have been written in PHP or C. I
>> chose C because I am more familar with its way of handling errors. And
>> it has slightly better tools to deal with things like timeouts on
>> sockets and so on.
>>
>> In short the two languages are pretty equivalent : PHP has better
>> screen output tools and HTML specific tools - the ability to spit out
>> raw HTML without 'printf' -ing it is the one reason I use it.
>>
>> But I hate its sloppy typing. Its a hacker's language.
>
> OK. I think I know which website you're updating with this scheme :-)

:-)
> and I'd agree that your approach is the best possible in the circumstance.
>
> But I disagree about PHP's typing. I find the relaxed typing saves me a
> lot of trouble. Same in JavaScript, where the only place I've been
> caught out recently by types is as follows:
>
> i = 3; // i is a nice integer
> elmntPtr.dataset.i = i; // Now save this for later use
>
> ...
>
> i = elmntPtr.dataset.i; // Get my i value back
>
> switch (i) // Doesn't effing work, i is a string
>
> switch (parseInt(i)) // OTOH, this works
>
>
> So the only place I've been fooled is by the fact that the HTML5 dataset
> attribute is always a string, which I discovered by trial & error and
> reading the spec. Very irritating.
>
> Otherwise the loose typing rules make for a relaxing life.
>
You try writing a parser for a data packet which has headers many of
whose content TYPES depend on what the header was, in a loosely typed
language.

Javascript is even worse as I found one instance that simply isn't
catered for by any spec, and IE and Firefox did the opposite things with it.


That cost me more time than any loose typing might have saved..


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: Only Allow exec in CLI [message #179215 is a reply to message #179213] Tue, 25 September 2012 11:17 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
Martin Leese wrote:
> crankypuss wrote:
>
>> On 09/24/2012 05:43 AM, The Natural Philosopher wrote:
>
>>> I cant imagine why anyone would put PHP in a cron job to start with.
>>>
>>> Shell script or C, or both...
>>
>> I can't imagine why anyone would write a shell script when PHP is
>> available.
>
> Stop whining and use Perl.
>
Pluperfectly Egregious Religious Language


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: Only Allow exec in CLI [message #179216 is a reply to message #179207] Tue, 25 September 2012 12:10 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 9/25/2012 9:37 AM, Anders Wegge Keller wrote:
> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>
>> On 9/25/2012 8:57 AM, Anders Wegge Keller wrote:
>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>>>
>>>> Why would you even set up a shell script to run the four programs
>>>> from cron? Why not just set cron up to run them itself?
>>>
>>> Can you answer that question yourself? I can think of several
>>> situations where it makes sense. If you cannot see any of those, you
>>> shouldn't comment on this subject.
>>>
>>
>> I don't see any reason to write a script like TNP suggests, when cron
>> can do it all by itself.
>
> How about:
>
> * Ensuring that command a isn't started until command @ has completed
> * Limiting the number of concurrent processes.
> * Grouping the output from several processes into the same cron status mail.
>
> As I said: refrain from discussing a subject where you are so
> woefully inadequate, that you cannot even see those simple reasons.
>


cron job:

script1; script2; script3; script4

As you (paraphrased) said: refrain from discussing a subject where you
are so woefully inadequate, that you cannot even see this simple example.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Only Allow exec in CLI [message #179217 is a reply to message #179216] Tue, 25 September 2012 12:25 Go to previous messageGo to next message
Anders Wegge Keller is currently offline  Anders Wegge Keller
Messages: 30
Registered: May 2012
Karma: 0
Member
add to buddy list
ignore all messages by this user
Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:

> script1; script2; script3; script4

Said the guy who're too afraid to use the php classloader, because he
is afraid someone will make a mess of it.


> As you (paraphrased) said: refrain from discussing a subject where you
> are so woefully inadequate, that you cannot even see this simple
> example.

My examples are still valid, even if you are determined to make an
ass out of yourself.

--
/Wegge

Leder efter redundant peering af dk.*,linux.debian.*
Re: Only Allow exec in CLI [message #179223 is a reply to message #179205] Tue, 25 September 2012 14:16 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 09/25/2012 07:23 AM, Tim Streater wrote:
> In article <k3s5u9$9hl$1(at)news(dot)albasani(dot)net>,
> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>
>> Tim Streater wrote:
>
>>> No checking of result codes required or error handling needed?
>
>> Yes. If they fail. they fail gracefully. and they leave errors in
>> their logfiles.
>
> Are they independent of each other then, such that they could be run in
> parallel? Or are there failure modes for program x that would mean you'd
> not want to run x+1 etc ??
>
>> And because C has better tools, they can be deigned to fail gracefully.
>
> What tools are you referring to?
>>> In your case you have 4 lines of code and run 4 executables. In my
>> app I > have some 11,500 lines of PHP and still run just the 4
>> executables.
>>>
>> I rest my case :-)
>
> <smack> :-)

I have a superstitious belief that it's bad luck to argue with morons.
Re: Only Allow exec in CLI [message #179226 is a reply to message #179213] Tue, 25 September 2012 14:20 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 09/25/2012 09:10 AM, Martin Leese wrote:
> crankypuss wrote:
>
>> On 09/24/2012 05:43 AM, The Natural Philosopher wrote:
>
>>> I cant imagine why anyone would put PHP in a cron job to start with.
>>>
>>> Shell script or C, or both...
>>
>> I can't imagine why anyone would write a shell script when PHP is
>> available.
>
> Stop whining and use Perl.

I have a superstitious belief that it's bad luck to argue with morons.
Re: Only Allow exec in CLI [message #179227 is a reply to message #179217] Tue, 25 September 2012 14:24 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 9/25/2012 12:25 PM, Anders Wegge Keller wrote:
> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>
>> script1; script2; script3; script4
>
> Said the guy who're too afraid to use the php classloader, because he
> is afraid someone will make a mess of it.
>

Ah, trolling again? What's the difference between calling script1 in
the cron job - or in a script which is called by the cron job? Answer:
nothing.


>
>> As you (paraphrased) said: refrain from discussing a subject where you
>> are so woefully inadequate, that you cannot even see this simple
>> example.
>
> My examples are still valid, even if you are determined to make an
> ass out of yourself.
>

You said you had to use a script to:

How about:

> * Ensuring that command a isn't started until command @ has completed
> * Limiting the number of concurrent processes.
> * Grouping the output from several processes into the same cron
> status mail.

I just showed you you're wrong. And you can't stand that.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Only Allow exec in CLI [message #179229 is a reply to message #179226] Tue, 25 September 2012 14:32 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
crankypuss wrote:
> On 09/25/2012 09:10 AM, Martin Leese wrote:
>> crankypuss wrote:
>>
>>> On 09/24/2012 05:43 AM, The Natural Philosopher wrote:
>>
>>>> I cant imagine why anyone would put PHP in a cron job to start with.
>>>>
>>>> Shell script or C, or both...
>>>
>>> I can't imagine why anyone would write a shell script when PHP is
>>> available.
>>
>> Stop whining and use Perl.
>
> I have a superstitious belief that it's bad luck to argue with morons.
>
s'all right. No one is arguing with you.


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: Only Allow exec in CLI [message #179231 is a reply to message #179227] Tue, 25 September 2012 14:38 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 09/25/2012 12:24 PM, Jerry Stuckle wrote:
> On 9/25/2012 12:25 PM, Anders Wegge Keller wrote:
>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>>
>>> script1; script2; script3; script4
>>
>> Said the guy who're too afraid to use the php classloader, because he
>> is afraid someone will make a mess of it.
>>
>
> Ah, trolling again? What's the difference between calling script1 in
> the cron job - or in a script which is called by the cron job? Answer:
> nothing.

Actually there'd be a tiny bit of added overhead due to the nested
script processor if you called it in a script called by the cron job, so
not /exactly/ nothing (but real close).
Re: Only Allow exec in CLI [message #179233 is a reply to message #179231] Tue, 25 September 2012 14:45 Go to previous messageGo to next message
Anders Wegge Keller is currently offline  Anders Wegge Keller
Messages: 30
Registered: May 2012
Karma: 0
Member
add to buddy list
ignore all messages by this user
crankypuss <no(at)email(dot)thanks> writes:

> On 09/25/2012 12:24 PM, Jerry Stuckle wrote:
>> On 9/25/2012 12:25 PM, Anders Wegge Keller wrote:
>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>>>
>>>> script1; script2; script3; script4
>>>
>>> Said the guy who're too afraid to use the php classloader, because he
>>> is afraid someone will make a mess of it.
>>>
>>
>> Ah, trolling again? What's the difference between calling script1 in
>> the cron job - or in a script which is called by the cron job? Answer:
>> nothing.
>
> Actually there'd be a tiny bit of added overhead due to the nested
> script processor if you called it in a script called by the cron job,
> so not /exactly/ nothing (but real close).

Actually, with the intellectual capabilities Mr. Stuckle ascribes to
himself in other advanced contexts, none of the four programs would
execute, if he tried to string them together in the same cron job.

If the miniscule overhead is of importance, theree are other problems
that should be adressed first.

--
/Wegge

Leder efter redundant peering af dk.*,linux.debian.*
Re: Only Allow exec in CLI [message #179240 is a reply to message #179233] Tue, 25 September 2012 16:08 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 9/25/2012 2:45 PM, Anders Wegge Keller wrote:
> crankypuss <no(at)email(dot)thanks> writes:
>
>> On 09/25/2012 12:24 PM, Jerry Stuckle wrote:
>>> On 9/25/2012 12:25 PM, Anders Wegge Keller wrote:
>>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>>>>
>>>> > script1; script2; script3; script4
>>>>
>>>> Said the guy who're too afraid to use the php classloader, because he
>>>> is afraid someone will make a mess of it.
>>>>
>>>
>>> Ah, trolling again? What's the difference between calling script1 in
>>> the cron job - or in a script which is called by the cron job? Answer:
>>> nothing.
>>
>> Actually there'd be a tiny bit of added overhead due to the nested
>> script processor if you called it in a script called by the cron job,
>> so not /exactly/ nothing (but real close).
>
> Actually, with the intellectual capabilities Mr. Stuckle ascribes to
> himself in other advanced contexts, none of the four programs would
> execute, if he tried to string them together in the same cron job.
>
> If the miniscule overhead is of importance, theree are other problems
> that should be adressed first.
>

Once again you have your head up your anal orifice.

http://team.macnn.com/drafts/crontab_defs.html

It works fine.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Only Allow exec in CLI [message #179271 is a reply to message #179179] Thu, 27 September 2012 13:23 Go to previous message
Ryan is currently offline  Ryan
Messages: 15
Registered: July 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
On Monday, September 24, 2012 4:43:34 AM UTC-7, The Natural Philosopher wrote:
> M. Strobel wrote:
>
>> Am 24.09.2012 01:14, schrieb cph:
>
>>> For security I am looking to add exec() and similar commands to the disable functions
>
>>> setting in php.ini but I do have a need to execute command line commands within a
>
>> cron job I am writing in PHP.
>
>>
>
>> The answer is highly dependent on your system setup, as has been said already.
>
>> I would start with a check to see if different .ini files for web server and CLI are
>
>> in place already.
>
>>
>
>> /Str.
>
>
>
> I cant imagine why anyone would put PHP in a cron job to start with.
>
>
>
> Shell script or C, or both...
>
>
>
> --
>
> Ineptocracy
>
>
>
> (in-ep-toc’-ra-cy) – a system of government where the least capable to
>
> lead are elected by the least capable of producing, and where the
>
> members of society least likely to sustain themselves or succeed, are
>
> rewarded with goods and services paid for by the confiscated wealth of a
>
> diminishing number of producers.

idk about the OP but if its me I'm a PHP developer not a C developer, I wouldn't know what to do in C. I'm not even all the good at shell script for that matter.
Quick Reply
Formatting Tools:   
Pages (2): [ «    1  2]  Switch to threaded view of this topic Create a new topic
Previous Topic: Advice for Literature on PHP-Based Web Development Business Models
Next Topic: Count how many times a value occurs in an array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Dec 16 08:13:08 EST 2017

Total time taken to generate the page: 0.00664 seconds