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' REMOTEfirstname.lastname@example.org:/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
Where does NetworkManager log since there is no daemon.log file in /var/log?
Where does systemd keep everything it logs?
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: 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?
Have you tried switching your $LOCAL and $REMOTE parameters around? It should be "sshfs $OPTIONS $REMOTE $LOCAL"
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)
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.