Re: Only Allow exec in CLI [message #179214 is a reply to message #179212] |
Tue, 25 September 2012 15:13 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
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 15:17 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
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 16:10 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
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 16:25 |
Anders Wegge Keller
Messages: 30 Registered: May 2012
Karma: 0
|
Member |
|
|
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 18:16 |
crankypuss
Messages: 147 Registered: March 2011
Karma: 0
|
Senior Member |
|
|
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 18:20 |
crankypuss
Messages: 147 Registered: March 2011
Karma: 0
|
Senior Member |
|
|
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 18:24 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
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 18:32 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
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 18:38 |
crankypuss
Messages: 147 Registered: March 2011
Karma: 0
|
Senior Member |
|
|
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 18:45 |
Anders Wegge Keller
Messages: 30 Registered: May 2012
Karma: 0
|
Member |
|
|
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 20:08 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
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 17:23 |
Ryan
Messages: 15 Registered: July 2012
Karma: 0
|
Junior Member |
|
|
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.
|
|
|