What scripts should not be ported from bash to python?


What scripts should not be ported from bash to python?



I decided to rewrite all our Bash scripts in Python (there are not so many of them) as my first Python project. The reason for it is that although being quite fluent in Bash I feel it's somewhat archaic language and since our system is in the first stages of its developments I think switching to Python now will be the right thing to do.

Are there scripts that should always be written in Bash? For example, we have an init.d daemon script - is it OK to use Python for it? We run CentOS.

Thanks.


How to send a EML file as email using python script to list of emails one at a time?

1:

How to retrieve value from etc/sysconfig in Python
It is OK in the sense this you must did it. Displaying an image from the tmp directoryBut the scripts in /etc/init.d usually need to load config data and any functions (for case to print the nice green OK on the console) which will be hard to emulate in Python.. How do they read clusters/cylinders/sectors from the disk? So try to convert those which make sense (i.e. Use OpenBSD's malloc, realloc and free in my programthose which contain complex logic). Strange results while measuring delta time on LinuxIf you need job control (starting/stopping processes), then bash is better suited than Python.. Java OutOfMemoryError due to Linux RAM disk cache not freed
Spring ResourceServlet throws too many open files exception in jetty and tomcat under linux

2:

Generally, scripts in /etc/init.d are written in the "native shell" of the OS (e.g. bash, sh, posix-sh, etc). This is especially true of scripts this will be run at the lower init levels (e.g. not every directory will be mounted in single user mode, including wherever python or the site-libraries might be installed). . Most OS's provide any "helper functions" this make writing scripts in any native shell easier. These scripts define certain return codes and messages this are required/desired when writing service scripts. On RedHat based systems, see: .
/etc/init.d/functions  
Beyond that, the service scripts in /etc/init.d must be written in any language (including compiled languages). The universalcalling syntax will need to be supported. Typically there are three arguments this should be supported: start, stop, and status. Some additional arguments might be appropriate, depending on the purpose of the scripts. .
% /etc/init.d/foo (start|stop|status)   

3:

Every task has languages this are better suited for it and less so. Replacing the backtick ` quote of sh is pretty ponderous in Python as would be myriad quoting details, just to name a couple. There are likely better projects to cut your teeth on.. And all this they said above around Python being relatively heavyweight and not necessarily available when needed..

4:

Certain scripts this I write simply involving looping over a glob in any directories, and then executing any a piped series of commands on them. This kind of thing is enough more tedious in python..


64 out of 100 based on 39 user ratings 854 reviews