LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2006, 07:34 AM   #1
gazman1
Member
 
Registered: Jan 2005
Posts: 40

Rep: Reputation: 15
script to check if a drive is mounted


I'm looking for a simple c script that will check if a drive called backup is mounted if its not do nothing and if it is send an email and dismount it. The sending email bit is easy I will using net::smtp but the rest??
 
Old 07-10-2006, 08:18 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
net::smtp is a perl module. how do you expect to use it in a c program?? there is nothing difficult at all, just use bash using the mount command and grep the output. then pipe it into the mail command. this sounds like a fairly poor solution to a simpel problem though... maybe you'd benefit from exploiting automount instead.
 
Old 07-10-2006, 08:25 AM   #3
gazman1
Member
 
Registered: Jan 2005
Posts: 40

Original Poster
Rep: Reputation: 15
sorry i ment to say perl rather than c, its simply going 2 b run wit a crontab becuase from time to time the sparse image dosent unmount after the backup is complete and this causes trouble during the next backup.
 
Old 07-10-2006, 09:09 AM   #4
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,173

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
This site might help, http://ccomb.free.fr/wiki/wakka.php?...StorageEnglish
In step 2 is a link for a Perl version.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to test is a drive is mounted in a shell script? agtlewis Linux - General 7 03-18-2009 09:58 AM
Check to see if a drive is mounted joshnya Linux - Newbie 2 11-07-2005 08:56 AM
script check to see if device is mounted Warmduvet Programming 14 09-03-2004 06:17 PM
Boot disk; check. CD in drive; check. Doesn't work; check. Hal DamnSmallLinux 7 02-04-2004 02:10 AM
SCRIPT: check if auto-mount mount-points are still mounted markus1982 Linux - Software 0 05-25-2003 05:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration