473,569 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to execute shell script using python scripts

1 New Member
I have a shell file in location
/home/transfer/check.sh

I need to excecute this shell file using python script
Apr 24 '12 #1
4 2178
Smygis
126 New Member
There is a module called subprocess. Look in to in.
May 5 '12 #2
BadOPCode
3 New Member
Pfft... hate it when people post RTFM.
If you just want a simple IO on the script file try

Expand|Select|Wrap|Line Numbers
  1. import commands
  2.  
  3. output = commands.getstatusoutput('/home/transfer/check.sh')
  4.  
That will return back a tupple of the return code and the string output to console.
If thats not quite right, you can check the commands module or if you need even more leverage with the console there is the module subprocess.

Edit: That is assuming you banged your shell script. If not you will have to change that to '/bin/sh /home/transfer/check.sh' OR just bang the script and give it execute permission.
May 30 '12 #3
dwblas
626 Recognized Expert Contributor
We generally don't anwser questions that can be easily found with a Google http://www.google.com/search?client=...hannel=suggest because that indicates that the person is just lazy.
May 31 '12 #4
dwblas
626 Recognized Expert Contributor
I like Doug Hellmann's explanation of subprocess.
May 31 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3035
by: Aashif | last post by:
I want to call Unix Shell script which is available in other Server (Unix server) from windows application using C#. Currently the shell script runs the C program but the GUI is not good, So I want to create GUI in C# windows application and call that C program using Shell script so first I have to call unix shell script from C#. Please guide me...
20
18853
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
2
11059
by: mesum98 | last post by:
Hi, I have a python script which creates a csv file using following method def printOutInformation(self): if self.orderby == 'r': self.iplist.sort(cmp=self.RealtimeComparison) elif self.orderby == 'p': self.iplist.sort(cmp=self.ProcessingtimeComparison) # by default the order will just...
3
2099
by: yogesh_anand | last post by:
Hi I am running one shell script from my application process which is running on sun solaris platform. If i run script suppose as "oracle" user then its successfully execute within process. But i login to machine as diffierent user suppose "sql" then its not executed successfully. I want if i login as any user on system i shd. be able...
1
3029
by: GnanaKumar | last post by:
hi, Can any one explain me how to execute COBOL program using Python scripts... do i need any third party tool to do this.. can you pls help me out regards, Gnana Kumar
0
1193
by: P. Adhia | last post by:
Hello, I was wondering if anyone is successfully using using Python(2.5)+DB2+pydb2. I get an error in all situations. It seems that this problem might be limited to python 2.5. A quick Google search suggests that with Python 2.5, memory model has become more stringent and mixing various types of memory calls are likely to produce this...
3
5442
by: telduivel | last post by:
Can someone please help me with this: I have a python script, that at some point calls a linux bash script (.sh). Starting the shell script is the last thing my python script needs to do, so I would like for the python script to exit once the call has been made, without waiting for the shell script to finish. My question is: how do I call...
0
1299
by: shaheda begum | last post by:
Hi everyone, Can anyone guide me how to link archive file(libxyssl.a) to my shell script( .sh file) in Perl using swig interface. Thank you in advance.
3
10025
by: BibhuAshish | last post by:
Hi, I have a button. I want to run a shell script when i click that button. My HTML code is given below: <html> <head> </head> <body> <input type = "button" value = "run script" onclick = "some javascript func to run script()"> </body>
3
9589
by: xtremebass | last post by:
Hi , I am want to run the shell script to run every 10 minutes of interval ,so that i have used crontab command for scheduling the shell script .. it cant works . i have checked wall command in crontab it is working properly when i try to run the shell script or even echo " name" cant to be worked using crontab. can you please help me out...
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.