Ok, so this is exactly what I'm running, word for word:
Code:
alex@kubuntu:/tmp$ cat test.sh
#!/bin/bash
while true; do
expect << EOD
spawn ssh stonecold@shell.cjb.net
expect 'stonecold@shell'
send "cd gelbooru; ./scrape_deleted.sh\n"
expect 'stonecold@shell'
send "logout\n"
EOD
echo "Done, sleeping 1 hour"
sleep 1h
echo "Restarting"
done
alex@kubuntu:/tmp$ ./test.sh
spawn ssh stonecold@shell.cjb.net
Last login: Sat Mar 30 05:58:58 2013 from 46.165.196.138
[stonecold@shell ~]$ cd gelbooru; ./scrape_deleted.sh
Started Sat Mar 30 05:59:29 MDT 2013
Scraping post 51303
Scraping post 51304
Scraping post 51305
Scraping post 51306
Scraping post 51307
Scraping post 51308
Scraping post 51309
Scraping post 51310
Scraping post 51311
Scraping post 51312
Scraping post 51313
Scraping post 51314
Scraping post 51315
Scraping post 51316
Scraping post 51317
Scraping post 51318
Scraping post 51319
Done, sleeping 1 hour
^C
I had to control+c because it only exits and says "Done, sleeping for 1 hour" when ssh (and expect) closes.
So the shell server is disconnecting very soon after I connect, and I need the script to be able to run a little while longer.
When I connect normally, run "cd gelbooru" and "./scrape_deleted.sh", I remain connected for a full hour if I have to. When I connect either using expect or " ssh stonecold@shell.cjb.net 'cd gelbooru; ./scrape_deleted.sh' ", it disconnects in several seconds. HOW to I prevent this specifically?