HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free and registered users see less advertising! If you just want to browse through the existing questions, just select the forum that you want to visit from the selection below. Otherwise, click here to register!. We highly recommend that you print a copy of our Guide for New Members. Enjoy!

SSH in a script question...

Hello, I have a MASSIVE backup script and the following lines are giving me fits... I am wanting to run 'df -hT' on the server, 'ls -lt' to list the timestamps of the directories present, and write this info to a logfile ON THE SERVER. Check this:

Keep in Mind: LOGLOCATION4=~/, BUSUBDIR=a form of today's date (I forget what I actually used here)

What is happening is that the df/ls log is being written to the home directory on the LOCAL machine instead of on the server. Then when 'cat' tries to find the file to send it out, it reports that it doesn't exist. I have tried various combinations of quotes and stuff, but am having no luck... Any help would be greatly appreciated.

Ah haa... See, I have done commands over ssh before, and never used quotes, but they were simple commands that didn't use any piping or redirection. Thanks for the help. I will change this script, and try it when I get home tonight (hopefully). Now, if I can just get my rsync excludes to work, I will be in business!

Okie dokie. I did have to change it a bit... On the diskspace and timestamp section, I had to use all " instead of '. That is one thing that ALWAYS trips me up... when to use " or ', AND when or not to escape them with '\'. The only thing I still can't get to work is the last line, where it 'cat's the logfile and is supposed to send it out. I get no errors, but I never receive the mail. I have tried running it directly on the server's command line, but it seems to be prompting me for something, with the only way out being ctrl+c or ctrl+d. At this point, it says "EOT" and exits. Beats me...
In all though, the entire script works like a champ now, exactly as I want it to, with the exception of the mail. Thanks!

Well, I tried this and it still isn't working for me. It does the same thing (looking like it is waiting for a response from me until I ctrl+c or d it). I have the executables 'mail' and 'mailx' on my Suse 10.1 system, but when I go to the man pages (either man mail, or man mailx) I am shown the man page for something called 'nail'. In that man page, a '-r' is the from address, and when this mail line used to work (well, it worked as in, I received no errors, and the screen returned to a prompt instead of waiting for me to do something), I had to have the -r <from-address> specified, or else it would do what it is doing now. So strange... Maybe I need to look into pine or some other tool in an attempt to send this unattended...