[Solved] How to start/stop service according to share state?

Ask questions about Arch Linux ARM. Please search before making a new topic.

[Solved] How to start/stop service according to share state?

Postby dhead666 » Mon Feb 25, 2013 7:04 pm

I'm using AufoFS to auto mount/unmount nfs share.

Regarding my post on running CrashPlan on Raspberry Pi I'm trying to figure out what the best way to start/stop the service according to the nfs share state.

I couldn't find any info regarding running commands or scripts when AutoFS mount/unmount, is it possible ?

If not, what would be the best approach solving this?


if that helps here are my configs:

/etc/autofs/auto.master
$this->bbcode_second_pass_quote('', ' ')/mnt/nfs4 /etc/autofs/auto.nfs4 -hosts --timeout=60

etc/autofs/auto.nfs4
$this->bbcode_second_pass_quote('', 's')hared -fstype=nfs4,ro,async3 192.168.1.2:/srv/nfs4


Thanks in advance.
Last edited by dhead666 on Tue Feb 26, 2013 5:57 am, edited 1 time in total.
Pogoplug Series 4 - Network Storage and Music Server: NFS/TVHeadend
Cubox-i2 - Applications Server: Lighttpd/CherryMusic/HTPCManager/Transmission/Couchpotato/SickBeard/OpenVPN
Samsung Chromebook: Chroach in ChromeOS
dhead666
 
Posts: 116
Joined: Sat Aug 11, 2012 10:25 pm

Re: How to start/stop service according to share state ?

Postby yeehaa » Mon Feb 25, 2013 8:00 pm

You could ping the server before mounting it.. Maybe put that in a script ..
yeehaa
 
Posts: 43
Joined: Mon May 21, 2012 7:54 pm

Re: How to start/stop service according to share state ?

Postby dhead666 » Tue Feb 26, 2013 5:56 am

$this->bbcode_second_pass_quote('yeehaa', 'Y')ou could ping the server before mounting it.. Maybe put that in a script ..


Well... I'm trying to avoid writing a script that will run constantly on the background.
I just wanted to keep this simple, but it seems like AutoFS doesn't support running script/commands on unmount.

The solution is much more simple, when a mount point isn't available at all CrashPlan will recognize that and won't think it was deleted, so no full resynchronizing will happen next time the mount is available.

The key is not using the --ghost parameter.
Pogoplug Series 4 - Network Storage and Music Server: NFS/TVHeadend
Cubox-i2 - Applications Server: Lighttpd/CherryMusic/HTPCManager/Transmission/Couchpotato/SickBeard/OpenVPN
Samsung Chromebook: Chroach in ChromeOS
dhead666
 
Posts: 116
Joined: Sat Aug 11, 2012 10:25 pm
Top


Return to User Questions

Who is online

Users browsing this forum: No registered users and 5 guests