You are not logged in.
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:
[Unit]
Description=devmon Service
[Service]
Type=simple
User=%i
# Set DISPLAY for popup dialogs
Environment=DISPLAY=:0
EnvironmentFile=/etc/conf.d/devmon
ExecStart=/usr/bin/devmon $ARGS
[Install]
WantedBy=multi-user.target
and this is the conf file:
ARGS="--mount-options ro --exec-on-drive '/usr/local/bin/upload %d'"
Thanks
Offline
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:
[Unit]
Description=Upload content to the cloud
After=devmon.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/upload /dev/sdX
[Install]
WantedBy=multi-user.target
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.
Offline