|
|
#1 |
|
Prospect
Join Date: Jun 2008
Posts: 21
|
script startup command
Hi,
I want to setup my personal Dropbox between my home server and the work station in the office. I followed this tutorial http://www.danbishop.org/2011/09/10/...-in-os-x-lion/ and get it working. The trouble now is I am not sure how I can make it to start on boot. I have to enter this command every time after a reboot. sshfs user@xxx.xxx.xxx.xxx:/Volumes/data/myDropbox /Volumes/data/Desktop/myDropbox then enter the password. My scripting skill is rather limited. Can anyone offer me some guidance how I can write a shell script or Apple script to accomplish this? I am on OSX 10.8.2. Thanks in advance. Last edited by MacPC; 02-16-2013 at 09:00 AM. |
|
|
|
|
|
#2 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,938
|
__________________
hayne.net/macosx.html |
|
|
|
|
|
#4 |
|
Prospect
Join Date: Jun 2008
Posts: 21
|
Hi thanks all for replying.
After some research I made this script called myDropbox.sh #!/usr/bin/myDropbox spawn sshfs user@xxx.xxx.xxx.xxx:/Volumes/data/htdocs/myDropbox /Volumes/data/Desktop/myDropbox expect "Password" send "myPwd\r" interact When I run it in Terminal, it seems like it was going to start because after the password and returns to the $ prompt. but it doesn't start. As I said my unix commands are rusty, can someone spot something wrong with the commands?Thanks again. |
|
|
|
|
|
#5 |
|
League Commissioner
Join Date: Aug 2006
Posts: 5,039
|
Can I ask a stupid question? Why not just install the Dropbox app?
That will ensure you have access to your Dropbox account through the Finder on each machine, automatically at login. You already have to install stuff to get this to work, in any case. |
|
|
|
|
|
#6 |
|
Prospect
Join Date: Jun 2008
Posts: 21
|
@benwiggy
"Can I ask a stupid question? Why not just install the Dropbox app?" Well, For one, my server has 2T of storage. And more importantly, it's more fun and satisfying to be a creator than a consumer, because in the process I learn something. I know, I am a big NERD!
Last edited by MacPC; 02-17-2013 at 08:43 AM. |
|
|
|
|
|
#7 |
|
Prospect
Join Date: Jun 2008
Posts: 21
|
I did it, Yea!
For those who are interested First set ssh to use ssh key authentication to by pass the password requirement. Then in AppleScript Editor Here is what my AppleScript looks like: /* ======= */ tell application "Terminal" do shell script "/usr/local/bin/sshfs user@xxx.xxx.xxx.xxx:/path_of_ remote_directory ~/Desktop/your_Dropboxname" end tell /* ====== */ Save it as Application in AppleScript Editor. Put the App in login items. VOLIÁ! the next time you start your Mac the virtual drive sits there like a real drive.
|
|
|
|
|
|
#8 |
|
League Commissioner
Join Date: Sep 2003
Location: Tokyo
Posts: 6,045
|
The answer to this question might be "the other computer is not a Mac", but why don't you just use afp and built-in File Sharing?
|
|
|
|
|
|
#9 |
|
League Commissioner
Join Date: Aug 2006
Posts: 5,039
|
I'm not sure that you need to tell Terminal to do a shell script. I think you can just "do one".
|
|
|
|
|
|
#10 |
|
Prospect
Join Date: Jun 2008
Posts: 21
|
@acme.mail.order "why don't you just use afp and built-in File Sharing?"
To make my boss feel more at ease when I work away from the office? :} @benwiggy " I'm not sure that you need to tell Terminal to do a shell script. I think you can just "do one"" Perhaps it is not needed, I will have to try it went I got home. Good point!
|
|
|
|
|
|
#11 |
|
League Commissioner
Join Date: Sep 2003
Location: Tokyo
Posts: 6,045
|
Yes, you can:
do shell script "command -o -p --tions" pitfalls: - it's sh, not bash - your normal environment is NOT loaded - repeat uses of do shell script are in a new shell - escaping quotes and spaces rapidly becomes a nightmare as you must escape from both the shell and Applescript in the correct order. |
|
|
|
|
|
#12 |
|
Prospect
Join Date: Jun 2008
Posts: 21
|
@benwiggy you are right. I don't need the "do shell script" , but seems like AppleScript Editor complains if I use "do one", I changed the script to this, it works just fine.
and@acme.mail.order Thank you both. /* ======= */ do do shell script "/usr/local/bin/sshfs user@xxx.xxx.xxx.xxx:/path_to_ remote_directory ~/Desktop/your_local_Dropbox_name" /* ====== */ Last edited by MacPC; 02-19-2013 at 07:29 PM. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|