You are not logged in.

#1 2014-01-14 12:24:04

Registered: 2010-07-09
Posts: 17

How to autostart script when devmon daemon starts?

I have installed Arch linux on a Raspberry Pi and configured devmon to automount an external USB hard drive when it is plugged in. It also runs a custom script to upload the contents of the drive to the cloud and unmounts the drive when it is unplugged.

This is all working fine, except for the case where the hard drive is already plugged in when the system boots up. The drive is mounted as normal when the devmon daemon is started, but the script is not run. This behaviour is confirmed when starting the daemon manually too.

Is there a way to make devmon automount the drive AND run the script when the daemon starts ?

This is my devmon service file:

Description=devmon Service

# Set DISPLAY for popup dialogs
ExecStart=/usr/bin/devmon $ARGS


and this is the conf file:

ARGS="--mount-options ro --exec-on-drive '/usr/local/bin/upload %d'"



#2 2014-01-24 08:26:37

Registered: 2008-11-12
Posts: 30

Re: How to autostart script when devmon daemon starts?

I don't know anything about devmon, so I'll suggest an alternative solution.
You could create another service that starts after the devmon one:

Description=Upload content to the cloud

ExecStart=/usr/local/bin/upload /dev/sdX


The only problem is that you need to be sure that your external drive will be /dev/sdX, or, alternatively you need to modify your 'upload' script to detect the right drive to upload.
I'll leave it to someone else to give you a solution that doesn't require an additional service and only uses devmon.


Board footer

Powered by FluxBB