Register
It is currently Mon Sep 01, 2014 7:55 pm

ssh bash script loop


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Jan 10, 2010 7:08 pm   

Joined: Fri Dec 11, 2009 11:27 am
Posts: 3
Im attempting to write my first bash script to automatically log on my friends to my ssh server. Im a bit confused on the loop or more so how to end the infinite loop however. Here is what I have right now.

Code:

#!/bin/bash
#bash script to connect to Mephisto file server with encrpyption keys

mountpoint="/home/malluen/storage"
remote_server="malluen.no-ip.org"
srv_loc="/mnt/storage"
srv_port="123"

for (( ; ; ))
do
         ping -c 3 $remote_server
         if [ $? -eq 0 ]
         then
                 sshfs -p $srv_port $USER@$remote_server:$srv_loc $mountpoint
         else
                 sleep 180
done


When I run it I get a syntax error for unexpected token 'done'.
From my research though I thought this would be correct. Where am i going wrong?


Top
 Profile  
 PostPosted: Sun Jan 10, 2010 7:37 pm   

Joined: Fri Dec 11, 2009 11:27 am
Posts: 3
nm I must be drunk. I forgot the fi statement to break the if/then.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP