Results 1 to 3 of 3

Thread: command does not work through CRON

  1. #1
    Join Date
    Aug 2019
    Beans
    5

    Thumbs up command does not work through CRON

    I have this command:

    Code:
    /usr/bin/screen -d -m -S NAMEOFSCREEN bash -c "ssh -i /root/chave.pem USER@IPADDRES tail -f -n +1 /var/log/apache2/other_vhosts_access.log | /usr/local/bin/goaccess -p /usr/local/etc/goaccess/goaccess.conf -o /var/www/dashboard.html --real-time-html --fifo-in=/tmp/linuxclaro.in --fifo-out=/tmp/linuxclaro.out --port=7890"


    It works fine from the shell, but when started from CRON it doesn't work, it doesn't give me any errors or anything.

    this command creates a realtime access dashboard for my apache using goaccess

    how can i run this command from crontab -e ?

    10 such commands will be executed with different parameters


    sorry for the bad english its translated from google tradutor


    explaining the context:
    I type SCREEN and hit ENTER
    I run this command:
    Code:
    ssh -i chave.pem USER@IP 'tail -f -n +1 /var/log/apache2/other_vhosts_access.log' | goaccess -p /usr/local/etc/goaccess/goaccess.conf -o /var/www/dashboard.html --real-time-html --fifo-in=/tmp/linuxclaro.in --fifo-out=/tmp/linuxclaro.out --port=7890
    AND AFTER
    CTRL+A AND CTRL + D
    to detach the "dashboard".

    I did it this way using the screen, because it was the only way I found to leave ssh active, already tried with nohup and etc but none worked.

  2. #2
    Join Date
    Jun 2014
    Beans
    7,383

    Re: command does not work through CRON

    Are you running that command from cron as you posted it, with a set time? Better chance to get it working if you put the commands in a script and then create a cron entry with the complete/full path to the location of the script in the cron entry.

  3. #3
    Join Date
    Dec 2019
    Beans
    1

    Re: command does not work through CRON

    Please try adding a single dash to read from the pipe. e.g.,

    Code:
    /usr/local/bin/goaccess - -p /usr/local/etc/goaccess/goaccess.conf -o /var/www/dashboard.html --real-time-html --fifo-in=/tmp/linuxclaro.in --fifo-out=/tmp/linuxclaro.out --port=7890

Tags for this Thread

Bookmarks

Posting Permissions

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