Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm really feeling stupid but I don't find the right search keywords to get something usefull out of google.

The problem: We are developing symfony1 and symfony2 applications (php). We are developing on windows machines, while our staging and production server are linux. We got some tasks which are done by a shell-script on linux. These tasks include: - Move files and folders (e.g. Testfiles on the staging folder) - Set folder permissions - run various commands

Right now, the shell scripts only are executed on the linux servers as they are not working on the windows machines. We would like to get to a point where we can run one script and, depending on environment, it executes the correct tasks.

Which language to choose for this tasks? I heard good things about python, but don't know if it really fits. I know some Perl, but don't think it's a good tool. Maybe there are languages which are designed for such problems?

share|improve this question

closed as not constructive by Zoredache, womble, Jason Berg, Ward, MDMarra Nov 15 '11 at 19:40

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

There are many cross platform languages that work for system administrative tasks. Perl, Python, and Ruby are all valid choices.

But those languages will not be able to auto-magically translate things that only make sense on Linux to the closest Windows equivalent. Setting permissions is different on Windows vs Linux. You will have to detect the OS and call the correct appropriate functions for that system.

Which language to choose for this tasks?

Choose a cross platform language that you are already familiar with. If you don't have any strong familiarity with any, pick one that looks cool.

Since you are developing PHP apps, you could always just install the PHP CLI everywhere. Since you are already using PHP you are familiar with it. While many might argue that PHP sucks, you can certainly get things done with it, and you are already using it.

share|improve this answer
I know I have to do some double code for windows and linux, but that would be fine. The main problem right now is simply that the shell scripts are only running on the servers and the tasks performed need to be done manually on the development pcs. I don't think we'll use php for it, but I'll definitly have a look at python. – Sgoettschkes Sep 1 '11 at 8:39

Are you saying that the problem is you're developing on Windows but deploying on Linux, and have scripts you want to run on both? I think you're going to find there are always some quirks unless there are some equivalent to #ifdef's in the script to figure out if it's running on Windows versus Linux, since there will be directory structure differences and such. Is there a reason you can't develop on a Linux system, or virtualize a Linux system on the Windows box so you're developing on the same platform you're building on?

You can get Python for Windows to run natively. And if you're using a UNIX-centric scripting language to do things (like Bash) you could install cygwin under Windows to have a POSIX environment in which to run things.

Personally, I'd virtualize a Linux system and save yourself some porting quirks and headaches. If you're asking for scripts that run under CRON on the server, install Cygwin and script it in Bash.

share|improve this answer

The Good answer: Move to linux on your desktops/laptops. You should be developing on the same platform the application is being served from.

The Hack-it-together-and-it-might-halfway-work answer: install cygwin on your dev machines, and you'll be able to run shell scripts.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.