You are not logged in.

#1 2013-04-02 12:55:53

kevdog
Member
Registered: 2013-01-26
Posts: 102

Network Manager dispatcher.d

I've created a script that I'd like Network Manager to run after the network is up.  I can run the script as root manually if I pass or set the $status variable and everything works, however I can't seem to get the script to run when I start NetworkManager service.  Where does NetworkManager log since there is no daemon.log file in /var/log?
Following script is within /etc/NetworkManager/dispatcher.d/ with permissions of 711.

Here is the script (very similar to what was posted in Arch Wiki):

#!/bin/bash

USER='xxxx'
REMOTE='xxxx@xxxxx.com:/home/xxxx'
LOCAL='/home/xxxx/mnt_sshfs'
OPTIONS="-o idmap=user -o follow_symlinks -C -p 22"

interface=$1 status=$2
case $status in
  up)
     sleep 5 
     #expect fwknop daemon call (Which is run as 49_fwknopcall)
     su "$USER" -c "sshfs $OPTIONS $LOCAL $REMOTE"
     ;;
   down)
     fusermount -u "$LOCAL"
     ;;
esac 	

Offline

#2 2013-04-02 23:07:08

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Network Manager dispatcher.d

kevdog wrote:

Where does NetworkManager log since there is no daemon.log file in /var/log?

Where does systemd keep everything it logs?

Offline

#3 2013-04-03 16:14:51

kevdog
Member
Registered: 2013-01-26
Posts: 102

Re: Network Manager dispatcher.d

Thanks for tip about journalctl!! Made a big difference.

Here is what the script is telling me:
Apr 03 11:45:08 orphan nm-dispatcher.action[553]: Script '/etc/NetworkManager/dispatcher.d/50-mount_sshfs_share_gohilton_2223.sh' took too long; killing it.

I'm guessing the ssh part where it attempts to connect to the remote server and mount the remote ssh is taking to long however even using journalctl in verbose mode really doesn't confirm this assumption. 

I'm wondering if this would best be done with systemd unit files?

Offline

#4 2013-04-09 15:17:00

MotoPsycho
Member
Registered: 2013-04-09
Posts: 1

Re: Network Manager dispatcher.d

Have you tried switching your $LOCAL and $REMOTE parameters around? It should be "sshfs $OPTIONS $REMOTE $LOCAL"

Offline

#5 2013-04-09 18:29:42

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: Network Manager dispatcher.d

Are you using ssh keys with a keychain? If so, have a look at this.

Last edited by hokasch (2013-04-09 18:29:52)

Offline

#6 2013-04-10 08:01:32

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Network Manager dispatcher.d

The dispatcher scripts have an automatic timeout of 3 seconds before the scripts get killed. For a while I have struggled with the same. You could try calling an external script from the  dispatcher which then calls sshfs.

Offline

Board footer

Powered by FluxBB