Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:33:36+00:00 2026-06-13T02:33:36+00:00

import subprocess def volumeCheck(volume_name): This function will check volume name is mounted or not.

  • 0
import subprocess

def volumeCheck(volume_name):
    """This function will check volume name is mounted or not.
    """
volume_name = raw_input('Enter volume name:')
volumeCheck(volume_name) 

p = subprocess.Popen(['df', '-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p1, err = p.communicate()
pattern = p1

new_vol = '/VolumeData/' '+ volume_name +'

if pattern.find(new_vol) != -1 :

    print 'volume mounted'

else:
    print 'volume not mounted'

new_vol = ‘/VolumeData/’ ‘+ volume_name +’ i think this is wrong , but how can i do this ..?

i like to search \volumeData\ volume_name .

root@sr-query:/# df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                938M  473M  418M  54% /
/dev/md0              938M  473M  418M  54% /
none                  250M  4.9M  245M   2% /dev
/dev/md2              9.7M  1.2M  8.0M  13% /usr/config
/dev/md7              961M   18M  895M   2% /downloads
tmpfs                 250M  7.9M  242M   4% /var/volatile
tmpfs                 250M     0  250M   0% /dev/shm
tmpfs                 250M     0  250M   0% /media/ram
/dev/mapper/vg9-lv9  1016M   65M  901M   7% /VolumeData/sp
/dev/mapper/vg10-lv10
                     1016M   65M  901M   7% /VolumeData/cp
root@sr-query:/# 

Thanks in adavnce

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:33:37+00:00Added an answer on June 13, 2026 at 2:33 am

    What exactly are you going for? If I understand properly, I would probably try os.path.join, e.g.:

    new_vol = os.path.join('/','VolumeData', volume_name)
    

    Also, since you’re not actually using the result of find, you might want to consider:

    if new_vol in p1:
    

    instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import subprocess def volumeCheck(volume_name): This function will check volume name is mounted or not.
Given this : import os import subprocess def check_server(): cl = subprocess.Popen([nmap,10.7.1.71], stdout=subprocess.PIPE) result
Currently I am using this: def _get_mac_ver(): import subprocess p = subprocess.Popen(['sw_vers', '-productVersion'], stdout=subprocess.PIPE)
this is the idea. I'll have 'main' python script that will start (using subprocess)
import subprocess import threading import StringIO class terminal(threading.Thread): def run(self): self.prompt() def prompt(self): x
import subprocess def my_function(x): return x + 100 output = subprocess.Popen(my_function, 1) #I would
import subprocess subprocess.Popen(['C:\Program Files\Nuke6.1v3\\Nuke6.1.exe', '-t', 'C:\Users\user\Desktop\\server.py' I am currently using this to call server.py,
I tried to use pp(Parallel Python) like this: import glob import subprocess import pp
When using python-daemon , I'm creating subprocesses likeso: import multiprocessing class Worker(multiprocessing.Process): def __init__(self,
import os import subprocess proc = subprocess.Popen(['ls','*.bc'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out,err = proc.communicate() print out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.