Initialization script for SSHFS
I am looking for a way to push an application (ruby/node/java) and have a script run prior to the application starting that will setup SSHFS and move some of the content onto the share before the application starts. I was able to get the sample wordpress application working which includes this script that does exactly that but it is written in Python https://github.com/dmikusa-pivotal/cf-ex-wordpress/blob/master/.extensions/wordpress/extension.py. ideally, I would have a generic shell script that would run and set up SSHFS on deployment.
I attempted to accomplish this using a shell script in .profile.d but havent been able to get it working. If I get into a container and run the shell script it works fine. This is the script (which follows the same pattern as the wordpress python script, just in bash):
mv $HOME/app/.ssh $HOME/
chmod 644 $HOME/.ssh/*
chmod 600 $HOME/.ssh/sshfs_rsa
mv $HOME/app/main.rb /tmp/
mkdir -p $HOME/app/SSHFS/
sshfs root(a)192.168.1.15:/root/ssh_target/ $HOME/app/SSHFS -o IdentityFile=$HOME/.ssh/sshfs_rsa -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o idmap=user -o cache=yes -o kernel_cache -o compression=no -o large_read
mv /tmp/main.rb $HOME/app/SSHFS/
fusermount -uz $HOME/app/SSHFS
Any ideas what I am doing wrong or if there is a better way to accomplish this?