dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: -bash: command not found Assistance Needed

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Posts
    171

    -bash: command not found Assistance Needed

    I have a shell script below that produces the following error:
    -bash: rotateLogs: command not found

    Can you tell me what might be the problem? Thanks.

    #!/bin/sh
    cd /usr/local/apache/logs
    cat access_log > access_log.prior-month ; cat /dev/null > access_log
    cat error_log > error_log.prior-month ; cat /dev/null > error_log
    Last edited by devel95; 01-15-2009 at 11:29 AM.

  2. #2
    Join Date
    May 2004
    Location
    FL
    Posts
    3,453
    It looks like you need to download a script to do what you want.

  3. #3
    Join Date
    Apr 2008
    Posts
    171
    Solved it myself.

    You need to run the script using the full path. I was running the script from the command prompt as rotateLogs.sh

    Run as /full/path/to/script/rotateLogs.sh
    or
    ./rotateLogs.sh

  4. #4
    Join Date
    Apr 2008
    Posts
    171
    Next problem. Now that I have the script working, I want to run it as a CRON job.

    I am using cpanel and when the crontab runs, I get a permission denied error on each of the 4 log files in the script.

    My log files are set as:
    -rw-r--r-- 1 root root

    My script is set as:
    -rwxr-xr-x 1 user user

    I believe it has something to do with the the cPanel user not being 'root'. So I changed my script to:
    -rwxr-xr-x 1 root root

    I still get permission denied on the 4 files.

    Any ideas on how I can get a cPanel CRONTAB to run in the case?

    Thanks.

  5. #5
    Join Date
    Apr 2008
    Posts
    171
    Solved it. Ended up bypassing cPanel's CRONTAB editor and SSH'd into crontab -e

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles