2 Replies Latest reply: Oct 13, 2012 7:06 PM by shorts
shorts Level 2 Level 2 (455 points)

Hi, I have been trying to get a launchd script working and it's not working and this error appears in the system log:

 

10/10/12 12:35:44 PM          com.sysadmin.bindfs[83]          Not a valid user ID: user1

10/10/12 12:35:44 PM          com.sysadmin.bindfs[83]          Not a valid user ID: user2

 

What I'm aiming to do is run a sftp chroot for virtual hosts and mount the chroot folders that are linked to to the corresponding vhost folders in Library/Webserver/Documents folder.

 

I've tested it and it works fine if I just run the commands or the script by itself via the terminal. The problem from there is that the bindfs mounts do not remount on startup. So I decided to make a launchd plist to located @ /Library/LaunchDaemons. I've been using Lingon (gui plist editor) to set it up as a Launch Daemon and call the script located in /usr/bin/bindfs.sh

 

I have chmod +x'ed the file and chowned to root. I've placed the script in /usr/bin (hope thats the correct or appropriate location and permissions)

 

#!/bin/bash

 

sudo /opt/local/bin/bindfs -u user1 /Library/Webserver/Documents/user1 /vhosts/user1/public_html

sudo /opt/local/bin/bindfs -u user2 /Library/Webserver/Documents/user2 /vhosts/user2/public_html

 

I've tried mucking around with the script ie removing sudo from the commands etc and its still not working.

 

The system is a 10.6.8 Snow Leopard Server.

 

What am I doing wrong? TIA

 

Shorts

  • 1. Re: Problem with Launchd running bash script and bindfs
    shorts Level 2 Level 2 (455 points)

    OK some more information here:

     

    I did a bit more research on Launch Daemons and decided to try and load it when the system after I had booted and logged in and got the following errors:

     

    10/10/12 3:11:10 PMcom.sysadmin.bindfs[1679]sudo: no tty present and no askpass program specified
    10/10/12 3:11:10 PMcom.sysadmin.bindfs[1679]sudo: no tty present and no askpass program specified

     

    I've already come across this error and have googled everywhere with no results.

     

    Then I tried unloading it and removing the sudo commands from the bash script and got two windows scrating Fuse4x failed to mount. The fuse4x failed to mount path.

  • 2. Re: Problem with Launchd running bash script and bindfs
    shorts Level 2 Level 2 (455 points)

    Solved this one myself with the help of somebody else familiar with bash scripts. The trick is to delay mounting the fuse volume by using sleep in the bash script. So:

     

    sleep 15 will make the script sleep for 15 seconds

     

    I just changed it to sleep 60 and it worked perfectly. Hope this helps somebody else.