This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to allow Cron to use non-POSIX shells like Powershell.exe and CMD.exe


----- Original Message ----- 
From: "Blair Sutton" <>
To: <cygwin>
Sent: Friday, June 06, 2008 4:16 AM
Subject: Re: Patch to allow Cron to use non-POSIX shells like Powershell.exe and CMD.exe


| 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.

Here is an even simpler solution: specify the shell you want in the crontab itself
Like
* * * * *  cmd /c "some DOS stuff"
* * * * *  powershell -command "some powershell stuff"
* * * * *  bash -c "some bash stuff"

No need to specify SHELL, no wrapper shell, mix and match interpreters, maximal flexibility.
And the top shell (sh) is smart and will exec the subshell because it recognizes
that's the only thing it has to do.  
To verify that, try  
strace sh -c "cmd /C sh -c \"/bin/echo hello\"" | grep -i 'spawn\|fork' 

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]