Problems running script

Help
2011-07-24
2013-05-29
  • Daniel Horton
    Daniel Horton
    2011-07-24

    I'm using this for the first time on CentOS.  The script runs through, I see some text flash in the terminal window, and then I get a blank screen that says the script ran successfully.  The individual backup folders were created, but are empty.  I got an email of the log and another that says there was an error in the subject line, but both emails are blank.  What are the (probably obvious) steps I should take to resolve this problem?

     
  • Harley
    Harley
    2011-07-24

    Hard to say..

    Change the script to output to stdout and then run it and you should see whats happening on screen..

     
  • Daniel Horton
    Daniel Horton
    2011-07-25

    i did that, but now I'm not receiving any email at all.  Weird.  Either way my ssh session was closing after running, so I started logging it to see what was going on that way…. here's the output:

    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: gawk: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: logger: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: echo: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: cat: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: basename: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: date: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: du: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: expr: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: find: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: mysql: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: mysqldump: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: gzip: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: bzip2: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: hostname: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: sed: not found
    -bash: alias: |: not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: --tty-only: not found
    -bash: alias: --read-alias: not found
    -bash: alias: --show-dot: not found
    -bash: alias: --show-tilde': not found
    -bash: alias: /usr/bin/which: not found
    -bash: alias: grep: not found
    -bash: -bash: command not found
    -bash: +%Y-%m-%d_%Hh%Mm: command not found
    -bash: +%A: command not found
    -bash: +%u: command not found
    -bash: +%d: command not found
    -bash: +%B: command not found
    -bash: +%V: command not found
    -bash: +%N: command not found
    -bash: +%N: command not found
    -bash: /backups/db/localhost-.log: Permission denied
    -bash: ###### WARNING ######: command not found
    -bash: Errors reported during AutoMySQLBackup execution.. Backup failed: command not found
    -bash: Error log below..: command not found
    -bash: /backups/db/ERRORS_localhost-.log: Permission denied
    -bash: alias: -f: not found
    -bash: alias: /backups/db/localhost-.log: not found
    -bash: alias: -f: not found
    -bash: alias: /backups/db/ERRORS_localhost-.log: not found
    
     
  • Harley
    Harley
    2011-07-26

    If you are using a shared hosted server then it looks like you ISP has massively restricted the ssh shell and what commands are available to you.. Its probably chrooted or something similar.. Might be worth asking them..

    If its your own server what OS are you running?
    Can you you run "hostname" or "which date" from the command line?

     
  • Daniel Horton
    Daniel Horton
    2011-07-26

    This is a MediaTemple (dv) running CentOS.  I've got full root access, can run both commands you referenced, and typically don't run into permissions-related issues.

     
  • Harley
    Harley
    2011-07-26

    Wierd… :)

    I know it seems strange but Is the bash shell available?

     
  • Daniel Horton
    Daniel Horton
    2011-07-26

    My skillset is going to start showing if you keep asking questions ;)

    I assume yes, but I guess I'm not really sure what that means… I can run other shell scripts without a problem, both from a terminal and cron. 

     
  • Harley
    Harley
    2011-07-26

    Don't worry about the skillset showing.. We all know different things to different levels.. :)

    Try run "which bash" which should return /bin/bash..  If it does make sure /bin/bash in the output of "cat /etc/shells"..

    I assume you have marked the file executable and not edited it on a windows PC at any point with any editor like notepad?

     
  • Daniel Horton
    Daniel Horton
    2011-07-26

    which bash returns /bin/bash
    cat / etc/shells includes /bin/bash
    File is marked as executable for owner (root)
    It was downloaded onto an Ubuntu machine and copied into the terminal from (probably) Sublime Text 2

    I'll also note that I'm running this from a configuration file, which I assume is being read properly, but potentially is not.  Maybe I'll try to run it all from the one file and report back, just to rule things out…

     
  • Harley
    Harley
    2011-07-26

    Hmmm.. The only thing from that which I'm not sure what you mean is "copied into the terminal".. Did you not upload the file as a whole through SCP?

    My thought is that if the file wasn't uploaded there is a chance the line breaks and not right and that may be why you are getting the errors..

    Can you upload the complete file and test again?

     
  • Daniel Horton
    Daniel Horton
    2011-07-26

    Yeah, initially I just copied / pasted it into nano using the Ubuntu terminal.  I really have no idea how to use SCP, but I just started from scratch w/ a fresh download from SourceForge and uploaded it to the server via SFTP (which I assume is a fine method, but correct me if I'm wrong).  I'm also no longer using the external configuration file.

    Maybe I'm running it incorrectly?  For testing, I'm doing the same thing I do that works to test my current backup script, which is to say that in the terminal I type the following:

    . backupscript.sh
    

    Can't thank you enough for your diligence.

     
  • Harley
    Harley
    2011-07-26

    Yes, SFTP or SCP are fine.. You could obviously also use wget to download the file directly to the server and edit it on the server with vi or whichever editor you prefer..

    All you really have to do is edit the basic settings of name and password and where you want the backups stored.. The rest is up to you what you want to change..

    To execute the script from a command line from the same directory the file is in simply use ./script.sh (make sure you have the dot in front).. If you are in another directory simply enter the full or relative path ie /home/user/script.sh.. As long as its marked as executable it will run..

     
  • Daniel Horton
    Daniel Horton
    2011-07-26

    So, in your opinion, is it always the last (and in this case, easiest) solution that works?

    I was trying to execute without the / before the file name.  I'm not entirely sure why it (sort of) ran with errors without the slash, but with the slash everything works like a charm. 

    Can't thank you enough for all your help (and hard work).

     
  • Harley
    Harley
    2011-07-26

    No problem.. Glad its working..