X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <2abc9c2d0806060116t2da2970as52d545f7a38560b7@mail.gmail.com> Date: Fri, 6 Jun 2008 09:16:41 +0100 From: "Blair Sutton" To: cygwin AT cygwin DOT com Subject: Re: Patch to allow Cron to use non-POSIX shells like Powershell.exe and CMD.exe In-Reply-To: <2abc9c2d0806051528w6aa5c8f5g6bf946291171d579@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <2abc9c2d0806040808s2178885ak5dcf7cd528ea685a AT mail DOT gmail DOT com> <2abc9c2d0806040948l2f6dc1cbjd99bbdaea65cf181 AT mail DOT gmail DOT com> <006701c8c756$1b923260$d50410ac AT wirelessworld DOT airvananet DOT com> <2abc9c2d0806051528w6aa5c8f5g6bf946291171d579 AT mail DOT gmail DOT com> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On further investigation, it appears powershell does alias "-c" for "-command" hence no changes would be required for cron to support it. However, the change would still be useful for other shells or perhaps interpreters like Perl. On Pierre's offered solution: I now do recall how exec works and it is correct that it replaces the current process - although a there will be some overhead. However, that begs the question why cron ever supported the SHELL parameter in the first place; if Mr Vixie wanted everyone to write a wrapper script using his preferred shell. On Thu, Jun 5, 2008 at 11:28 PM, Blair Sutton wrote: > I'm not sure if that's a very good solution. It spawns an unnecessary > bourne shell process on each new cron job. > > Don't worry if you don't want to make the change. I will maintain my > own separate branch and perhaps post the patch with some instructions > somewhere online where other people may find it useful. > > Best regards > Blair > > On 6/5/08, Pierre A. Humblet wrote: >> ----- Original Message ----- >> From: "Blair Sutton" <> >> To: >> Sent: Wednesday, June 04, 2008 12:48 PM >> Subject: Patch to allow Cron to use non-POSIX shells like Powershell.exe and >> CMD.exe >> >> >> | Hi >> | >> | This is a very simple patch for Cron to allow one to use a shell like >> | powershell or cmd. I've done some testing and it appears to work well. >> | >> | I simply introduce a new environment variable called SHELLSWICTH that >> | defaults to "-c" if not used. Otherwise, one can set it to "/c" or >> | "-Command" for Windows shells. >> | >> >> ************ >> Hi Blair, >> >> I maintain cron for cygwin, thanks for your contribution. >> There are other simple ways to achieve your goals, >> without changing cron. >> >> For example SHELL could be /some/path/sh2powershell >> and sh2powershell be a sh script such as >> #! /bin/sh >> shift >> exec powershell -Command "$*" >> >> Wouldn't that work as well for you? >> >> Pierre >> -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/